everpure.flasharray.purefa_preset module – Manage Fusion fleet block workload presets
Note
This module is part of the everpure.flasharray collection (version 1.46.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install everpure.flasharray.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: everpure.flasharray.purefa_preset.
New in everpure.flasharray 1.46.0
Synopsis
Create, replace, rename or delete Fusion fleet workload presets for block (FlashArray volume) workloads.
A preset is the template that everpure.flasharray.purefa_workload builds a workload from. It names a placement, the volumes to provision there, and optionally QoS limits, snapshot schedules, replication schedules, deploy-time parameters and tags.
The preset is managed declaratively and as a whole. Every run compares the preset you describe with the preset on the fleet and, when they differ, replaces the fleet’s copy with yours. See the notes for what that means for sections you leave out.
Only block presets are supported. File presets (directories, exports, quotas), and the bucket and lifecycle sections of newer Purity releases, are not managed by this module, and it refuses to replace a preset that has them.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.3
purestorage >= 1.19
py-pure-client >= 1.88.0
netaddr
requests
pycountry
urllib3
Parameters
Parameter |
Comments |
|---|---|
FlashArray API token for admin privileged user. |
|
ID of the API Client that issues the identity token. Used with private_key_file. |
|
A brief description of the workload the preset configures. Up to 1024 characters. |
|
Disable insecure certificate warnings in debug logs Choices:
|
|
FlashArray management IPv4 address or Hostname. |
|
A pre-signed JWT to authenticate with, as an alternative to api_token. The token is exchanged by the array for a short-lived access token. Requires a matching API Client to be registered on the array (see everpure.flasharray.purefa_apiclient). |
|
The API Client’s trusted identity issuer registered on the array. Used with private_key_file. |
|
Key ID of the API Client that issues the identity token. Used with private_key_file. |
|
Name of the preset. Presets are fleet objects that the API names Between 1 and 63 characters. Letters, numbers and |
|
New name for the preset, applied with a rename. Only valid with state=present. The preset name must exist, or already have been renamed to new_name by an earlier run, and new_name must not already be in use by another preset. Any other change in the task is made first, under the old name, and the rename last. If the rename is then refused, the task fails and says that the content was replaced but the rename was not made. Follows the same naming rules as name. |
|
Values the user is asked for when a workload is created from the preset. Fields that accept a parameter reference use them. Every parameter must be used somewhere in the preset, and every reference must name a parameter defined here. |
|
Values the user may choose from. At most 5. Valid for type=string, up to 64 characters each, and type=integer. |
|
Value used when none is given. For type=integer a whole number. For type=boolean Must be one of allowed_values when those are set, and for an integer between minimum and maximum. |
|
Description of the parameter. Up to 1024 characters. |
|
Human-friendly name shown in the GUI. Up to 64 characters. |
|
Largest acceptable value, inclusive. Only valid for type=integer. |
|
Smallest acceptable value, inclusive. Only valid for type=integer. |
|
Name of the parameter. Letters, numbers and |
|
Kind of resource the parameter refers to. Required for type=resource_reference and not valid otherwise. Use The array fails with an internal error for any other value, so only these two are accepted. The user may choose any resource of that kind. Purity//FA 6.10.6 accepts exactly one allowed value for the parameter, naming only the resource type, and refuses a named resource in it, so there is no option to restrict the choice. A preset on the fleet whose parameter is restricted to named resources differs from the task and is replaced. Choices:
|
|
Hint to the GUI about the kind of quantity the value is, which it uses to prompt for the value with suitable units. Only valid for type=integer. The array refuses a subtype on any other type. The choices are the five values Purity//FA 6.10.6 accepts. The array fails with an internal error for any other value, so a value outside the list is refused before any request is made. Choices:
|
|
Type of value the parameter collects. Choices:
|
|
Where the workload’s volumes are deployed. A preset has exactly one placement and every volume uses it. Required when state=present. |
|
Name of the placement configuration. It must be unique among all the configuration names in the preset, whatever their type. Default: |
|
Name of the entry in qos to apply to the volumes in this placement. The limits are shared by all of the placement’s volumes. |
|
The storage class the placement can be deployed to. Give exactly one of name or parameter. A parameter reference written as a template in name is refused. The array does not check that the storage class exists. A misspelt name is accepted when the preset is saved and fails only when a workload is created from it. |
|
Name of the storage class, for example |
|
Name of a parameters entry of type=resource_reference and resource_type=storage-classes, whose value is chosen when a workload is created. |
|
The fleet member the placement is deployed to. At most one. When omitted the target is the fleet member that receives the workload request. Give exactly one of name or parameter in each entry. A parameter reference written as a template in name is refused. Each entry must name a member that exists even when skip_verify_deployable is true. Requires REST API 2.54 or higher. |
|
Name of the fleet member. |
|
Name of a parameters entry of type=resource_reference and resource_type=remote-arrays, whose value is chosen when a workload is created. |
|
Path to the PEM RSA private key used to sign an identity token, as an alternative to api_token. Requires client_id, key_id, issuer and username. |
|
Password protecting private_key_file, if encrypted. |
|
QoS limit configurations. At most one entry. Each must be used by placement.qos. |
|
Bandwidth limit in bytes per second shared by all the volumes in the placement. From 1048576 (1 MiB/s) to 549755813888 (512 GiB/s). A whole number, or a parameter reference. See the notes for how to write one. |
|
IOPS limit shared by all the volumes in the placement. Between 100 and 100000000. A whole number, or a parameter reference. See the notes for how to write one. |
|
Name of the QoS configuration. It must be unique among all the configuration names in the preset, whatever their type. |
|
Naming template for the QoS policy that is created. When omitted, a configuration that is already on the fleet keeps the template it has, and a new one gets the array’s default. To change the template set it explicitly. To return to the default set it to the default pattern. The default pattern on Purity//FA 6.10.6 is {{functions.left(workload.name, 25)}}-{{functions.left(workload.configuration.name, 25)}}. |
|
Periodic replication (snapshot replication) configurations. At most two entries. Each must be used by at least one entry in volumes. |
|
Name of the replication configuration. It must be unique among all the configuration names in the preset, whatever their type. |
|
Naming template for the replication policy that is created. When omitted, a configuration that is already on the fleet keeps the template it has, and a new one gets the array’s default. To change the template set it explicitly. To return to the default set it to the default pattern, which is the same as for qos. |
|
The frequency and retention of the replicated snapshots. One or two rules. The same suboptions and rules as snapshots.rules. |
|
Time of day at which to take the snapshot, in milliseconds since midnight. Only valid when every is a whole number of days, and only on the first rule. A whole number, or a parameter reference. See the notes for how to write one. |
|
Interval between snapshots in milliseconds. A whole number, or a parameter reference. See the notes for how to write one. |
|
How long snapshots are kept before being eradicated, in milliseconds. Must not be shorter than every. A whole number, or a parameter reference. See the notes for how to write one. |
|
Snapshot suffix. Can be set on one rule only, the one with the largest keep_for. |
|
The remote array snapshots are replicated to. The array accepts any name here, including the array the volume is on, so check it. Give exactly one of name or parameter. A parameter reference written as a template in name is refused. |
|
Name of the remote array. |
|
Name of a parameters entry of type=resource_reference and resource_type=remote-arrays, whose value is chosen when a workload is created. |
|
When true the array makes only the most basic syntax checks, instead of also asking each fleet member whether it could deploy a workload from the preset. Useful for loading a preset that no member can deploy yet, so that it can be edited into shape. This setting is an instruction for the request and is not stored in the preset. It is not part of the comparison made to decide whether the preset changed. Choices:
|
|
Snapshot schedule configurations. At most two entries. Each must be used by at least one entry in volumes. |
|
Name of the snapshot configuration. It must be unique among all the configuration names in the preset, whatever their type. |
|
Naming template for the snapshot policy that is created. When omitted, a configuration that is already on the fleet keeps the template it has, and a new one gets the array’s default. To change the template set it explicitly. To return to the default set it to the default pattern, which is the same as for qos. |
|
What a workload does about snapshot policies. With The array defaults to Choices:
|
|
The frequency and retention of the snapshots. One or two rules. Intervals of all rules must be multiples of each other. A rule has no time zone. The array refuses one on a FlashArray preset, so there is no option for it. |
|
Time of day at which to take the snapshot, in milliseconds since midnight. Only valid when every is a whole number of days, and only on the first rule. A whole number, or a parameter reference. See the notes for how to write one. |
|
Interval between snapshots in milliseconds. A whole number, or a parameter reference. See the notes for how to write one. |
|
How long snapshots are kept before being eradicated, in milliseconds. Must not be shorter than every. A whole number, or a parameter reference. See the notes for how to write one. |
|
Snapshot suffix. Can be set on one rule only, the one with the largest keep_for. |
|
Define whether the preset should exist or not.
Choices:
|
|
Tags added to workloads built from the preset. Keys must be unique within a namespace. |
|
Whether the tag is copied when the volume it is on is copied. Choices:
|
|
Key of the tag. Up to 64 characters. |
|
Namespace of the tag. Namespaces that begin with Default: |
|
Value of the tag. Up to 256 characters, and not empty. The array fails with an internal error for a tag without a value. May be a parameter reference. See the notes for how to write one. |
|
Username the issued token should be granted to. Must be a valid user on the array. Used with private_key_file. |
|
The volumes the preset provisions. Between 1 and 5 entries. Required when state=present. The total number of volumes, the sum of the count values, can be at most 500. |
|
Number of volumes to provision. A whole number, or a parameter reference. See the notes for how to write one. Default: |
|
Name of the volume configuration. It must be unique among all the configuration names in the preset, whatever their type. |
|
Naming template for the volumes created from this configuration. When omitted, a configuration that is already on the fleet keeps the template it has, and a new one gets the array’s default. To change the template set it explicitly. To return to the default set it to the default pattern. The default pattern on Purity//FA 6.10.6 is {{functions.left(workload.name, 25)}}-{{functions.left(workload.configuration.name, 25)}}-{{functions.pad_left(workload.configuration.index, 4)}}. |
|
Name of the placement configuration. Defaults to the one placement in placement, so it only needs setting to make the reference explicit. |
|
Virtual size of each volume in bytes. Must be a multiple of 512 and at most 4503599627370496 (4 PiB). A whole number, or a parameter reference. See the notes for how to write one. |
|
Names of the entries in replications to apply to these volumes, each at most once. |
|
Names of the entries in snapshots to apply to these volumes, each at most once. |
|
The kind of workload the preset configures. Required when state=present. The array accepts any text here without complaint, so the module checks it against the documented list. Choices:
|
Notes
Note
Requires Purity//FA REST API 2.51 or higher, 2.54 for placement.targets.
Writing a preset needs a fleet-wide identity, that is a directory user, and an API token made for it. A token made for a local array user can read presets but every write fails with a 403 error, and the module says so.
The preset is replaced as a whole. Anything you leave out of the task is empty after the run. That is how a section is removed, and it also means an edit made to the preset in the GUI that the task does not describe is lost the next time the task changes something. The one exception is a configuration’s naming template, which is kept when the task leaves it out.
The module decides whether anything changed by comparing the preset on the fleet, read back from the array, with the preset described by the task. The array spells numbers as text and fills in defaults, which are not counted as differences. A naming template the task leaves out is taken from the configuration of the same name and kind on the fleet, both for the comparison and for the request, so a replacement made for another reason does not reset it.
Parameter references. Fields that accept one take a value such as
{{ parameters.volume_size }}, which the array fills in when a workload is created. Ansible would expand that text itself, so it has to be protected, either by writing the value with the!unsafetag in YAML or by wrapping it in{% raw %}and{% endraw %}. See the examples.Most mistakes that the array would report one at a time, or not at all, are found before any request is made, and reported together. These are references to configurations that do not exist, configurations nothing uses, a name used by two configurations, parameters that are undefined or unused, and the limits. The array does not check placement.storage_class or replications.target, so a wrong value is found only when a workload is created from the preset.
The module cannot predict whether the array will accept the preset in check mode, only whether it would change. In particular it cannot tell whether placement.targets or skip_verify_deployable would be accepted.
Supports
check_modeand--diff. The difference shown is between the preset on the fleet and the preset described by the task, both in the module’s normalised form, not the exact request.Preset names are scoped to the fleet. The module always reads and writes through the fleet, wherever the connection is made.
This module requires the
py-pure-clientPython library.Additional Python libraries may be required for specific modules.
You must set
PUREFA_URLandPUREFA_APIenvironment variables if fa_url and api_token arguments are not passed to the module directly.Token-based authentication (id_token, or private_key_file with client_id, key_id, issuer and username) may be used as an alternative to api_token, and requires a matching API Client registered on the array via everpure.flasharray.purefa_apiclient.
See Also
See also
- everpure.flasharray.purefa_workload
Manage Fusion Fleet Workloads.
- everpure.flasharray.purefa_info
Collect information from Everpure FlashArray.
Examples
- name: Create a preset with one placement and one volume
everpure.flasharray.purefa_preset:
name: app-small
workload_type: Custom
description: One 1 GiB volume
placement:
storage_class:
name: flasharray-x
volumes:
- name: data
provisioned_size: '1073741824'
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create a preset with QoS, a snapshot schedule and a replication schedule
everpure.flasharray.purefa_preset:
name: app-protected
workload_type: PostgreSQL
placement:
name: pg-placement
qos: pg-qos
storage_class:
name: flasharray-x
qos:
- name: pg-qos
iops_limit: '50000'
bandwidth_limit: '1073741824'
snapshots:
- name: hourly
rules:
- every: '3600000'
keep_for: '86400000'
replications:
- name: offsite
target:
name: arrayB
rules:
- every: '86400000'
keep_for: '604800000'
at: '7200000'
volumes:
- name: data
count: '2'
provisioned_size: '107374182400'
snapshots: [hourly]
replications: [offsite]
tags:
- key: app
value: postgres
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create a preset that asks for the size, the storage class and a tag at deploy time
everpure.flasharray.purefa_preset:
name: app-flexible
workload_type: Custom
parameters:
- name: vol_size
type: integer
subtype: size
default: '1073741824'
minimum: 1073741824
maximum: 1099511627776
- name: tier
type: resource_reference
resource_type: storage-classes
default: flasharray-x
- name: env
type: string
default: dev
allowed_values: [dev, test, prod]
placement:
storage_class:
parameter: tier
volumes:
- name: data
# A parameter reference has to be protected from Ansible's own templating.
provisioned_size: !unsafe '{{ parameters.vol_size }}'
tags:
- key: environment
# The same protection written as a raw block.
value: "{% raw %}{{ parameters.env }}{% endraw %}"
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Remove the snapshot schedule by leaving it out, because the whole preset is replaced
everpure.flasharray.purefa_preset:
name: app-protected
workload_type: PostgreSQL
placement:
name: pg-placement
qos: pg-qos
storage_class:
name: flasharray-x
qos:
- name: pg-qos
iops_limit: '50000'
volumes:
- name: data
provisioned_size: '107374182400'
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Rename a preset and show what would change
everpure.flasharray.purefa_preset:
name: app-small
new_name: app-tiny
workload_type: Custom
placement:
storage_class:
name: flasharray-x
volumes:
- name: data
provisioned_size: '1073741824'
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
check_mode: true
diff: true
- name: Load a preset that no fleet member can deploy yet
everpure.flasharray.purefa_preset:
name: app-draft
workload_type: Custom
skip_verify_deployable: true
placement:
storage_class:
name: flasharray-x
volumes:
- name: data
provisioned_size: '1073741824'
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Delete a preset
everpure.flasharray.purefa_preset:
name: app-small
state: absent
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The preset before and after, as text, in the module’s normalised form. A naming template the task leaves out is shown on both sides as it is on the fleet. On a rename the old and new names are part of the text, so the change shows even when nothing else differs. Returned: when running with |
|
Describes the preset after the task. Returned: success |
|
The top-level sections of the preset that the run changed, or in check mode would change. Empty when nothing changed. A create or delete lists every section that was set or unset. Returned: success Sample: |
|
Name of the preset. This is the new name after a rename. It is the name that was asked for after a delete, or in check mode when the preset does not exist yet. Returned: success Sample: |
|
Revision counter the array keeps for the preset. It is null after a delete, and in check mode where the preset does not exist yet. The counter is increased by the array and is not a reliable sign of a change. Use changed. Returned: success Sample: |