HPE Storage Tech Insiders
cancel
Showing results for 
Search instead for 
Did you mean: 

Mastering Nimble Storage with Puppet

mmattsson

Infrastructure-as-code was a paradigm introduced in the mid two thousand to manage infrastructure in a more scalable fashion than error-prone human interaction with API driven cloud era systems. Puppet and Chef are by far the biggest household names in this space and new tools are emerging to find new ways to abstract complexity from intricate system architectures. One of the most prominent principles is the declarative nature on how tasks should be carried out. Manifests, recipes and playbooks (depending on what tool you're using) are human readable stanzas that could be source code controlled and peer reviewed, just like code.

Unlike Ansible and Chef, which has generic HTTP modules to manipulate our REST API, Puppet needs a custom module to declare and manipulate NimbleOS. We recently published an Open Source Puppet module for Nimble Storage on GitHub. It's also accessible from Puppet Forge.

In the current release the following resources are available to manage:

  • Volumes and Snapshots
  • Volume Collections and Protection Templates
  • Initiators and Initiator Groups
  • Access Control Records

Documentation is available on the resource types found in the module itself, available in the "types" section on Puppet Forge. A few in depth examples are available in the git repo README.md file.

In a Puppet environment using a Hiera data backend, a mount point may be declared as such:

---
agent:
  - nimblestorage::init
  - nimblestorage::chap
  - nimblestorage::initiator_group
  - nimblestorage::initiator
  - nimblestorage::protection_template
  - nimblestorage::volume_collection
  - nimblestorage::volume
  - nimblestorage::acr
  - nimblestorage::fs_mount

iscsiadm:
  config:
    ensure: present
    port: 3260
    target: 192.168.59.64
    user: "%{alias('chap.username')}"
    password: "%{alias('chap.password')}"

chap:
  ensure: present
  username: chapuser
  password: password_25-24
  systemIdentifier: example-chap-account

initiator:
  ensure: present
  groupname: "%{::hostname}"
  label: "%{::hostname}:sw-iscsi"
  ip_address: "*"
  access_protocol: "iscsi"
  description: "This is an example initiator"
  subnets:
    - Management

multipath:
  config: true

volumes:
  example-vol:
    ensure: present
    name: example-vol
    size: 1000m
    description: Example Volume
    perfpolicy: default
    force: true
    online: true
    vol_coll: example-vol-coll

access_control:
  example-vol:
    ensure: present
    volume_name: example-vol
    chap_user: "%{alias('chap.username')}"
    initiator_group : "%{::hostname}"
    apply_to: both

mount_points:
  example-vol:
    ensure: present
    target_vol: example-vol
    mount_point: /mnt/example-vol
    fs: xfs
    label: example-vol

On the host used in the example above, we'll end up with the following when calling the puppet agent:

[vagrant@agent ~]$ sudo puppet agent -t 
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for agent.localdomain
Info: Applying configuration version '1496597926'
Fact's are being picked up
Notice: /Stage[main]/Nimblestorage::Host_init/Host_init[prepare_facts]/ensure: created
Creating New CHAP Account -> chapuser
Notice: /Stage[main]/Nimblestorage::Chap/Nimble_chap[chap-account]/ensure: created
Creating New initiatorgroup agent
Notice: /Stage[main]/Nimblestorage::Initiator_group/Nimble_initiatorgroup[initiator-group]/ensure: created
Creating New Initiator iqn.1994-05.com.redhat:a977584934c
Will assign iqn: 'iqn.1994-05.com.redhat:a977584934c' with label agent:sw-iscsi to group agent
Creating New initiator agent
Notice: /Stage[main]/Nimblestorage::Initiator/Nimble_initiator[initiator]/ensure: created
Creating New Volume example-vol
Notice: /Stage[main]/Nimblestorage::Volume/Nimble_volume[example-vol]/ensure: created
Notice: /Stage[main]/Nimblestorage::Acr/Nimble_acr[example-vol]/ensure: created
Notice: /Stage[main]/Nimblestorage::Iscsiinitiator/Nimblestorage::Iscsi[config]/File[/etc/iscsi/iscsid.conf]/ensure: defined content as '{md5}cbd6728303be5281fac35a02fb2149a2'
Info: /Stage[main]/Nimblestorage::Iscsiinitiator/Nimblestorage::Iscsi[config]/File[/etc/iscsi/iscsid.conf]: Scheduling refresh of Service[iscsid]
Notice: /Stage[main]/Nimblestorage::Iscsi::Service/Service[iscsid]: Triggered 'refresh' from 1 events
iscsiadm: No active sessions.
iscsiadm: No active sessions.
/dev/mapper/mpathc on /mnt/example-vol type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
Notice: /Stage[main]/Nimblestorage::Fs_mount/Nimble_fs_mount[example-vol]/ensure: created
Notice: Applied catalog in 6.15 seconds
[vagrant@agent ~]$ df -h /mnt/example-vol
Filesystem          Size  Used Avail Use% Mounted on
/dev/mapper/mpathc  997M   33M  965M   4% /mnt/example-vol

Now we have all the stanzas declared, we can quite easily make changes and re-apply it. Let's increase the size of the volume:

<snip>
volumes:
  example-vol:
    ensure: present
    name: example-vol
    size: 2000m
    description: Example Volume
    perfpolicy: default
    force: true
    online: true
<snip>

And re-apply:

[vagrant@agent ~]$ sudo puppet agent -t 
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for agent.localdomain
Info: Applying configuration version '1496598141'
Fact's are being picked up
Notice: /Stage[main]/Nimblestorage::Host_init/Host_init[prepare_facts]/ensure: created
Updating existing initiatorgroup agent . Values to change {"target_subnets"=>[{"id"=>"1a23afebda5c91693c000000000000000000000006", "label"=>"Management"}]}
Notice: /Stage[main]/Nimblestorage::Initiator_group/Nimble_initiatorgroup[initiator-group]/ensure: created
Updating existing Volume example-vol with id = 0623afebda5c91693c00000000000000000000000e. Values to change {"size"=>2000}
Notice: /Stage[main]/Nimblestorage::Volume/Nimble_volume[example-vol]/ensure: created
Re Discovering and refreshing
/dev/mapper/mpathc on /mnt/example-vol type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/mapper/mpathc on /mnt/example-vol type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/mapper/mpathc on /mnt/example-vol type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
Notice: /Stage[main]/Nimblestorage::Fs_mount/Nimble_fs_mount[example-vol]/ensure: created
Notice: Applied catalog in 4.89 seconds
[vagrant@agent ~]$ df -h /mnt/example-vol
Filesystem          Size  Used Avail Use% Mounted on
/dev/mapper/mpathc  2.0G   33M  2.0G   2% /mnt/example-vol

A simple volume increase should be just that. Simple, declarative and unambiguous. Since the Hiera data backend is plain YAML files these become extremely easy to manipulate programmatically by external systems, such as end-user provisioning portals.

Are you using Puppet or any other automation tool (homegrown or mainstream) to manage your Nimble Storage environment? Please let us know!

About the Author

mmattsson

Data & Storage Nerd, Containers, DevOps, IT Automation

Events
See posts for
dates/locations
HPE at 2018 Technology Events
Learn about the technology events where Hewlett Packard Enterprise will have a presence in 2018.
Read more
See posts for dates/locations
Reimagine 2018
Join us at one of the Reimagine 2018 stops and see how we Simplify Hybrid IT, innovate at the Intelligent Edge and bring it all together with HPE Poin...
Read more
View all