At Pure Storage®, we aim to eradicate the complexity of traditional storage. Consistent with our commitment to deliver Smart Storage that is effortless, we want to ensure that customers can integrate Pure Storage FlashArrays into their automation infrastructure. With the growth of DevOps practices, one of the major tools in use today to help manage infrastructure through automation is Puppet—so Pure Storage is pleased to announce the first release of our Puppet module.
The Puppet module can be found on the Pure Storage OpenConnect GitHub website or directly from Puppet Forge by using the following command to install the module directly:
1 |
# puppet module install purestorage-puppet |
About the Pure Puppet Module
We are starting with basic functionality around volume and iSCSI host management, and expect to deliver a much wider range of supported functionality including host groups, protection groups and snapshots in upcoming releases. We are also planning on making fibre channel connectivity available in the next release as well.
Let’s go over the module, its configuration and usage in its current form.
First, this module was written to utilise the FlashArray’s RestAPI calls from API v1.6. This API version was made available with Purity v4.7.0 so if you want to use this Puppet module your FlashArray must have a minimum version of 4.7.0.
There are three types available in this initial release of the module, those being volume
, hostconfig
and connection
. Using these types you can quickly provision storage and attach it via iSCSI from a Pure Storage FlashArray to a host.
The Pure Puppet Module
The Puppet module connects to the Pure Storage FlashArray using the management IP address (or an FQDN) and an Admin privileged account, whether that be local or managed through Active Directory or LDAP if your array is integrated into one of these. A URL connection string is provided that holds this information, including the account name and password. Expect full API token use to be available in the next release of this module.
The Puppet module we have produced will enable any of the three major Puppet initiation methods to be used, these being:
- Puppet Device
- Puppet Agent
- Puppet Apply
I’m going to assume a knowledge of Puppet here and a working Puppet environment, but first I should note that in the resource definitions the ensure
attribute has only two possible values, these being present
and absent
. These are effectively the create and delete actions for the resource. When calling resources you must make sure that they are called in the correct order otherwise you will get errors. For example, you can’t create a host to volume connection if you haven’t already created both the host and the volume.
By changing your volume
resource attribute volume_size
to be a value larger than the current volume size and your ensure attribute to be present
, you can extend the size of an existing volume.
Puppet Device
The connection URL for Puppet to manage your Pure Storage FlashArray comes from your device.conf file where you call the type ‘pure’ and define your URL.
The URL takes the standard form and must contain the admin privileged username and associated password for the array you wish to manage. An example of device.conf is shown here:
1 2 3 |
[array1.nyc.purestorage.com] type pure url https://<username>:<password>@array1.nyc.purestorage.com |
In your default manifest (usually /etc/puppet/manifests/site.pp
) you specify your resource declarations, in other words, the actions to execute on the defined array. An example of this would be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
node ‘array1.nyc.purestorage.com’ { #–> This is Device name volume{ ‘pure_storage_volume’: #ensure either “present” or “absent” ensure => ‘present’, volume_name => ‘test_volume’, volume_size => ‘2G’, } hostconfig{ ‘pure_storage_host’: ensure => ‘present’, host_name => ‘test-host’, host_iqnlist => [‘iqn.1993-08.org.debian:01:b5cd43f3e43’,‘iqn.1993-08.org.debian:01:b5cd56f3e43’], } connection{ ‘pure_storage_connection’: ensure => ‘present’, host_name => ‘test-host’, volume_name => ‘test_volume’, #Added dependency on volume and host resource types #to be present, other wise connection will fail. require => [Volume[‘pure_storage_volume’], Hostconfig[‘pure_storage_host’] ], } } |
To execute this manifest just run the puppet device
command.
Puppet Agent
Puppet agent is the client/slave side of the puppet master/slave relationship. When using this method the connection information needs to be included in the manifest supplied to the agent from the master or it could be included in a custom fact passed to the client. The connection string must be supplied as a URL. Add example manifest for this method would be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
node ‘agent.nyc.purestorage.com’ { #–> This is Agent name #Note : device_url is MANDATORY here. $device_url = ‘https://<username>:<password>@array1.nyc.purestorage.com’ volume{ ‘pure_storage_volume’: #ensure either “present” or “absent” ensure => ‘present’, volume_name => ‘test_volume’, volume_size => ‘2G’, device_url => $device_url, } hostconfig{ ‘pure_storage_host’: ensure => ‘present’, host_name => ‘test-host’, host_iqnlist => [‘iqn.1993-08.org.debian:01:b5cd43f3e43’,‘iqn.1993-08.org.debian:01:b5cd56f3e43’], device_url => $device_url, } connection{ ‘pure_storage_connection’: ensure => ‘present’, host_name => ‘test-host’, volume_name => ‘test_volume’, #Added dependency on volume and host resource types #to be present, other wise connection will fail. require => [Volume[‘pure_storage_volume’], Hostconfig[‘pure_storage_host’] ], #Mandatory only for Puppet Apply and Agent approach. device_url => $device_url, } } |
In the case of Puppet Agent, connections to the Pure Storage array will be initiated from every machine which utilizes the Pure Storage puppet module this way.
To execute your manifest just run the usual puppet agent –t
command.
Puppet Apply
Using this client only application of a local manifest puppet apply is supported in a similar way to puppet agent. The connection string must be supplied as a URL within the actual manifest along with your resource definitions. The following example manifest will create volume and a host and then attach them together:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
node ‘puppet’ { #–> This is Puppet master name #Note: device_url is MANDATORY here. $device_url = ‘https://<username>:<password>@array1.nyc.purestorage.com’ volume{ ‘pure_storage_volume’: #ensure either “present” or “absent” ensure => ‘present’, volume_name => ‘test_volume’, volume_size => ‘2G’, device_url => $device_url, } hostconfig{ ‘pure_storage_host’: ensure => ‘present’, host_name => ‘test-host’, host_iqnlist => [‘iqn.1993-08.org.debian:01:b5cd43f3e43’,‘iqn.1993-08.org.debian:01:b5cd56f3e43’], device_url => $device_url, } connection{ ‘pure_storage_connection’: ensure => ‘present’, host_name => ‘test-host’, volume_name => ‘test_volume’, #Added dependency on volume and host resource types #to be present, other wise connection will fail. require => [Volume[‘pure_storage_volume’], Hostconfig[‘pure_storage_host’] ], #Mandatory only for Puppet Apply and Agent approach. device_url => $device_url, } } |
Just run the following command to execute your manifest:
1 |
# puppet apply /etc/puppet/manifests/site.pp |
The above example manifest you would produce the following:
1 2 3 4 5 6 7 |
Notice: Compiled catalog for puppet in environment production in 0.05 seconds Error: [{“pure_err_key”: “err.friendly”, “code”: 11, “ctx”: “test_volume_1”, “pure_err_code”: 1, “msg”: “Volume does not exist.”}] Notice: /Stage[main]/Main/Node[puppet]/Volume[pure_storage_volume]/ensure: created Error: [{“pure_err_key”: “err.friendly”, “code”: 6, “ctx”: “test-host”, “pure_err_code”: 1, “msg”: “Host does not exist.”}] Notice: /Stage[main]/Main/Node[puppet]/Hostconfig[pure_storage_host]/ensure: created Notice: /Stage[main]/Main/Node[puppet]/Connection[pure_storage_connection]/ensure: created Notice: Finished catalog run in 0.81 sec |
The error messages you see are normal and are an artefact of the Puppet module checking the volume and host don’t already exist before creating them.