Before writing the body of your playbook, it is a good idea to study the Ansible docs for the Dell modules to know the functionality of each of the modules. Figure 5 lists the PowerMax modules with the ansible-doc -l | grep -i powermax command.
To view the documentation for any of the listed modules simply type ansible-doc <module name> on your Ansible server as shown in Figure 6. You must use the full qualified canonical name (FQCN) to access the documentation, such as Ansible-doc dellemc.PowerMax.dellemc_PowerMax_gatherfacts.
The help will detail any parameters required for running tasks with the module. Parameters listed with “=” are required for running tasks with the module, optional parameters are indicated with “-“.
A full list of examples along with sample code appears in the EXAMPLES section. Pressing the “/” key and typing “EX” bring you directly to the examples. The EXAMPLES section in the Ansible docs will be invaluable as you write playbooks, because you can simply copy and reformat the code for your playbooks or adapt it to meet your needs.
Each PowerMax module is multifunctional and designed so that it can be run in an idempotent manner. Reviewing the examples highlights the full range of functions, including an example for each supported and tested function of a module.
Whether you are writing an Ansible task to deploy storage or installing a service on a Linux server, the Ansible module usually has a state parameter with a value that can be set to present or absent.
Setting the state to present assumes the object should exist and the Ansible module will do one of the following:
Setting the state to absent tells the Ansible task to delete the object or ignore it if there is no object on the storage array that matches the description.
Best Practice: The PowerMax API is built around the storage group as the management construct. The simplest route to any automation task can usually be achieved by using the storage group as the management construct. This will become more evident in the examples shown. The exception to this rule is on volume operations, such as volume delete and volume resize. These are handled exclusively in the dellemc_PowerMax_volume module.
The connection parameters to Unisphere include
Please note that the array credentials should be handled with care and should not be revealed to all users. Any user who has the array credentials can login to the Linux host and provision storage using the Ansible modules. Users require admin privileges to run playbooks that execute provisioning tasks. Users require replication privileges to operate snapshot operations. Authentication can be integrated with LDAP and Role Based Access by means of the Unisphere for PowerMax configuration on a per array basis
Best Practice: create a separate user account for Ansible on Unisphere and provide the user the required permissions (storage admin) granting permission on all arrays to be managed by Ansible. Employing other tools for securing passwords are also recommended for increased security. Ansible vault is one way of securing credentials.