string(7) "English"

Using Puppet to Manage your Pure Storage FlashArray

puppet logo
With the growth of DevOps practices, one of the major tools in use today to help manage infrastructure through automation is Puppet. 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, so Pure Storage is pleased to announce the first release of our 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.
puppet_image_blog
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:

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:

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:

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:

Just run the following command to execute your manifest:

The above example manifest you would produce the following:

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.

The Puppet module can be found on the Pure Storage OpenConnect GitHub website (https://github.com/PureStorage-OpenConnect/purestorage-puppet) or directly from Puppet Forge by using the following command to install the module directly: