start of change

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.

  1. Simple installation.
  2. Ensure meeting the prerequisites before creating a cluster. For example, updating the /etc/hosts and /etc/cluster/rhosts files.
  3. 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.

  1. 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.
  2. Install the PowerHA SystemMirror version 7.2.8, or later, on the centralized node.
  3. 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.
  4. 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.
    ansible --version 
    The output displays the Ansible is installed on your system.
  5. 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>.
  6. 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
  7. 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:

    1. Login as a root or as a privileged user in the centralized node.
    2. Copy the tarball from path “/usr/es/sbin/cluster/samples/ansible/” to path “/”.
    3. Switch to the home (#cd) or to the root (home) directory where the tarball needs to be extracted.
    4. Extract the following tarball.
      # gunzip /usr/es/sbin/cluster/samples/ansible/ansible_powerha_tarball.tar.gz
    5. Extract the contents of the tarball by running the following command.
      # tar -xvf /usr/es/sbin/cluster/samples/ansible/ansible_powerha_tarball.tar
      After extraction, two new folders with the following contents are created.
      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
  8. 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
  9. 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.
  1. Go to the /etc/ansible directory and open the host file with any available editors. The application has been tested with vi editor.
    # vi /etc/ansible/hosts
    Example /etc/ansible/hosts:
    Update the file with the IP addresses of the target nodes, appropriate username, and python path for the nodes.
    ######## 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.
  2. 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
  3. 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.
  1. To create map hosts, enter the following command:
     ansible-playbook demo_map_hosts.yml
  2. To create a standard cluster, enter the following command:
    ansible-playbook demo_cluster.yml --tags standard
  3. To create a linked cluster, enter the following command:
    ansible-playbook demo_cluster.yml --tags linked
  4. To create a stretched cluster, enter the following command:
    ansible-playbook demo_cluster.yml --tags stretched
  5. To remove a cluster, enter the following command:
    ansible-playbook demo_cluster.yml --tags delete
  6. To create a resource group, enter the following command:
    ansible-playbook demo_resource_group.yml –tags create
  7. To remove a resource group, enter the following command:
    ansible-playbook demo_resource_group.yml –tags delete
  8. To add a network, enter the following command:
    ansible-playbook demo_network.yml –tags create
  9. To remove a network, enter the following command:
    ansible-playbook demo_network.yml –tags delete
  10. To add an interface, enter the following command:
    ansible-playbook demo_interface.yml –tags create
  11. To remove an interface, enter the following command:
    ansible-playbook demo_interface.yml –tags delete
  12. To add a file system, enter the following command:
    ansible-playbook demo_file_system.yml –tags create
  13. To remove a file system, enter the following command:
    ansible-playbook demo_file_system.yml –tags delete
  14. To add an application, enter the following command:
    ansible-playbook demo_applications.yml –tags create
  15. To remove an application, enter the following command:
    ansible-playbook demo_applications.yml –tags delete
  16. To add a volume group, enter the following command:
    ansible-playbook demo_volume_groups.yml –tags create
  17. To remove a volume group, enter the following command:
    ansible-playbook demo_volume_groups.yml –tags delete
  18. To add a Service IP address, enter the following command:
    ansible-playbook demo_service_ip.yml –tags create
  19. To remove a Service IP address, enter the following command:
    ansible-playbook demo_service_ip.yml –tags delete
  20. To start Cluster Services, enter the following command:
    ansible-playbook demo_start_stop_services.yml –tags start
  21. To stop Cluster Services, enter the following command:
    ansible-playbook demo_start_stop_services.yml –tags stop
  22. To add AIX Workload Partitions (WPAR), enter the following command:
    ansible-playbook demo_wpar.yml –tags create
  23. To remove WPAR, enter the following command:
    ansible-playbook demo_wpar.yml –tags delete
  24. To add Network File System v2v3 (NFS), enter the following command:
    ansible-playbook demo_nfsv2v3.yml –tags create
  25. To remove NFSv2v3, enter the following command:
    ansible-playbook demo_nfsv2v3.yml –tags delete
  26. To add NFSv4, enter the following command:
    ansible-playbook demo_nfsv4.yml –tags create
  27. To remove NFSv4, enter the following command:
    ansible-playbook demo_nfsv4.yml –tags delete
  28. To install PowerHA SystemMirror, enter the following command:
    ansible-playbook demo_PowerHA.yml –tags install
  29. To uninstall PowerHA SystemMirror, enter the following command:
    ansible-playbook demo_PowerHA.yml –tags uninstall
  30. To install the Cluster health, enter the following command:
    ansible-playbook demo_cluster_health.yml
  31. To move the Resource group, enter the following command:
    
    ansible-playbook demo_move_resource_group.yml
Notes:
  1. All the field input values are mentioned in the comments in the /etc/ansible/external_var.yml file.
  2. For running start and stop cluster services playbook, you do not update any value in the /etc/ansible/external_var.yml file.
  3. NODES and NODE_DETAILS variables in the /etc/ansible/external_var.yml file are mandatory for working with any playbook.
  4. You can refer to the Sample_external_var.yml located in the /etc/ansible for updating external_var.yml file.
  5. Make sure to check the status of the cluster as a prerequisite to run the Ansible playbook.
end of change