Ansible integration with PowerHA SystemMirror
The Ansible® collections for PowerHA® SystemMirror® filesets are located in the
/usr/es/sbin/cluster/samples directory in the form of a tar file (compressed
format). You can extract the Ansible collections from the
tar file and integrate the ansible collections with the centralised node after installing PowerHA SystemMirror 7.2.8 or later.
Note: A centralized
node is the server that stores and manages the Ansible
playbook and roles. The centralized node simplifies the Ansible management by providing a single location for storing and updating the Ansible content.
To configure the PowerHA SystemMirror cluster and resources, you can run
the Ansible playbooks from the centralized node. Note: A
playbook is a set of instructions that defines how to automate a task or a process.
The Ansible framework helps you with the following.
- Simple installation.
- Ensure meeting the prerequisites before creating a cluster. For example, updating the /etc/hosts and /etc/cluster/rhosts files.
- Configure various resources like resource group, volume group, file system, service IP network, interfaces, applications, WPAR, NFSv2v3, and NFSv4.
Prerequisites
Before you get started with the Ansible integration, ensure that your system meets the following requirements.
- Ensure that the centralized node is running on the IBM® AIX® version 7.2 or 7.3, or later for better compatibility with the IBM AIX file sets.
- Install the PowerHA SystemMirror version 7.2.8, or later, on the centralized node.
- Install Python on both the centralized and the remote servers. Note: It is mandatory to install the Python. Python version 3.7.9 is compatible with AIX 7.2 and AIX 7.3. If you are using higher version of AIX, check python compatible version and use it. For more information see, Ansible Releases and maintenance.
- Install the Ansible filesets on the centralized node.
To download the ansible software package, see https://www.ibm.com/support/pages/aix-toolbox-linux-applications-downloads-alpha.Verify that the Ansible is installed on the centralized node by running the following command.
The output displays the Ansible is installed on your system.ansible --version
- Establish password-less Secure socket shell (SSH) connections between the centralized node and
the host nodes to communicate with the remote servers without requiring a password. You can check
password-less connectivity by running the command:
ssh <remote node ip>
. - Ensure Remote Shell Communication (RSH) is enabled on all nodes. Check the /etc/inetd.conf file to verify they the RSH is enabled on all nodes by uncommenting RSH-related fields and then update the /.rhosts file with double plus sign (++). For more details, see .rhosts File Format for TCP/IP
- Extract the Ansible filesets from the tarball provided
in the PowerHA SystemMirror installable files.
The tarball is located in the centralized node in the
/usr/es/sbin/cluster/samples/ansible/ path.
To the extract the Ansible filesets, complete the following steps:
- Login as a root or as a privileged user in the centralized node.
- Copy the tarball from path “/usr/es/sbin/cluster/samples/ansible/” to path “/”.
- Switch to the home (#cd) or to the root (home) directory where the tarball needs to be extracted.
- Extract the following tarball.
# gunzip /usr/es/sbin/cluster/samples/ansible/ansible_powerha_tarball.tar.gz
- Extract the contents of the tarball by running the following command.
After extraction, two new folders with the following contents are created.# tar -xvf /usr/es/sbin/cluster/samples/ansible/ansible_powerha_tarball.tar
- power_ha folder
- This folder contains Ansible roles, playbooks, and a
template file. To access power_ha folder, enter the following
path:
/.Ansible/collections/ansible_collections/ibm/power_ha
- Ansible folder
- This folder contains the ansible.cfg host file, template file, and external
variable file. To access Ansible folder, enter the
following path:
/etc/ansible
- To locate and run the Ansible binary file, update the path variable. The Ansible binary files are generally installed in the /opt/freeware/bin directory. To update the path
variable, run the following
command.
# export PATH=$PATH:/opt/freeware/bin
- To verify the installed version of ansible, run the following command.
# ansible –-version
Ansible driven deployment
To install and configure various resources by using the Ansible playbook, you must complete the following steps.
- Go to the /etc/ansible directory and open the host file with any available
editors. The application has been tested with vi editor.
Update the file with the IP addresses of the target nodes, appropriate username, and python path for the nodes.# vi /etc/ansible/hosts Example /etc/ansible/hosts:
######## POWERHA Ansible STARTS ########### [powerha_remote_servers] # provide PowerHA servers ip addresses # Example: x.x.x.x x.x.x.x [powerha_remote_servers:vars] ansible_user='root' ansible_python_interpreter='/usr/bin/python3' ######## POWERHA Ansible ENDS ###########
Note: Step 1 is essential for the Ansible to identify and connect to the remote servers. - Open the external_vars.yml file located in the
/etc/ansible directory. Update the file with the values of
NODE_DETAILS and NODES and Test
case variable details specific to your environment. This file customizes variables that
are used in your Ansible playbooks. To update variables in
vi editor, run the following
command.
# vi /etc/ansible/external_var.yml
- Once steps 1 and 2 are completed and the necessary variables are updated, you can now run Ansible playbook. Go to the path /.ansible/collections/ansible_collections/ibm/power_ha, and run the Ansible commands along with the necessary tags. Example: To change the working directory and run a playbook with specific tags, use the following command.
# cd /.ansible/collections/ansible_collections/ibm/power_ha/playbooks # ansible-playbook demo_playbook.yml --tags <tag1>,<tag2>.
This step selectively runs tasks or roles within the playbook based on the provided tags.
Ansible Playbooks
You can use the following commands from the playbooks to install, uninstall, configure, and
unconfigure PowerHA SystemMirror cluster and
resources.
- To create map hosts, enter the following
command:
ansible-playbook demo_map_hosts.yml
- To create a standard cluster, enter the following
command:
ansible-playbook demo_cluster.yml --tags standard
- To create a linked cluster, enter the following command:
ansible-playbook demo_cluster.yml --tags linked
- To create a stretched cluster, enter the following command:
ansible-playbook demo_cluster.yml --tags stretched
- To remove a cluster, enter the following command:
ansible-playbook demo_cluster.yml --tags delete
- To create a resource group, enter the following command:
ansible-playbook demo_resource_group.yml –tags create
- To remove a resource group, enter the following command:
ansible-playbook demo_resource_group.yml –tags delete
- To add a network, enter the following command:
ansible-playbook demo_network.yml –tags create
- To remove a network, enter the following command:
ansible-playbook demo_network.yml –tags delete
- To add an interface, enter the following command:
ansible-playbook demo_interface.yml –tags create
- To remove an interface, enter the following command:
ansible-playbook demo_interface.yml –tags delete
- To add a file system, enter the following command:
ansible-playbook demo_file_system.yml –tags create
- To remove a file system, enter the following command:
ansible-playbook demo_file_system.yml –tags delete
- To add an application, enter the following command:
ansible-playbook demo_applications.yml –tags create
- To remove an application, enter the following command:
ansible-playbook demo_applications.yml –tags delete
- To add a volume group, enter the following command:
ansible-playbook demo_volume_groups.yml –tags create
- To remove a volume group, enter the following command:
ansible-playbook demo_volume_groups.yml –tags delete
- To add a Service IP address, enter the following command:
ansible-playbook demo_service_ip.yml –tags create
- To remove a Service IP address, enter the following command:
ansible-playbook demo_service_ip.yml –tags delete
- To start Cluster Services, enter the following command:
ansible-playbook demo_start_stop_services.yml –tags start
- To stop Cluster Services, enter the following command:
ansible-playbook demo_start_stop_services.yml –tags stop
- To add AIX Workload Partitions (WPAR), enter the following
command:
ansible-playbook demo_wpar.yml –tags create
- To remove WPAR, enter the following command:
ansible-playbook demo_wpar.yml –tags delete
- To add Network File System v2v3 (NFS), enter the following command:
ansible-playbook demo_nfsv2v3.yml –tags create
- To remove NFSv2v3, enter the following command:
ansible-playbook demo_nfsv2v3.yml –tags delete
- To add NFSv4, enter the following command:
ansible-playbook demo_nfsv4.yml –tags create
- To remove NFSv4, enter the following command:
ansible-playbook demo_nfsv4.yml –tags delete
- To install PowerHA SystemMirror, enter the
following command:
ansible-playbook demo_PowerHA.yml –tags install
- To uninstall PowerHA SystemMirror, enter the
following command:
ansible-playbook demo_PowerHA.yml –tags uninstall
- To install the Cluster health, enter the following command:
ansible-playbook demo_cluster_health.yml
- To move the Resource group, enter the following command:
ansible-playbook demo_move_resource_group.yml
Notes:
- All the field input values are mentioned in the comments in the /etc/ansible/external_var.yml file.
- For running start and stop cluster services playbook, you do not update any value in the /etc/ansible/external_var.yml file.
- NODES and NODE_DETAILS variables in the /etc/ansible/external_var.yml file are mandatory for working with any playbook.
- You can refer to the Sample_external_var.yml located in the /etc/ansible for updating external_var.yml file.
- Make sure to check the status of the cluster as a prerequisite to run the Ansible playbook.