Chapter 4. Removing extension nodes

You must create a backup of the Ansible Automation Platform deployment before removing extension nodes.

Follow these steps to remove execution nodes from your Ansible Automation Platform from GCP Marketplace environment.

Prerequisites

  • Linux or macOS system (where the ansible-on-clouds-ops container image will run)
  • Docker

Steps

  1. Pull the ansible-on-clouds-ops container image.
  2. Generate data files by running the ansible-on-clouds-ops container.
  3. Update the data file.
  4. Run the ansible-on-clouds-ops container to remove the extension nodes.

4.1. Pulling the ansible-on-clouds-ops container image

Pull the Docker image for the Ansible on Clouds operational container with the same tag as your foundation deployment.

Note

Before pulling the docker image, make sure you are logged in to registry.redhat.io using docker. Use the following command to login to registry.redhat.io.

$ docker login registry.redhat.io

For more information about registry login, read Registry Authentication

For example, if your foundation deployment version is 2.4.20230630-00, you must pull the operational image with tag 2.4.20230630 to deploy extension nodes to the foundation deployment.

Use the following commands:

$ export IMAGE=registry.redhat.io/ansible-on-clouds/ansible-on-clouds-ops-rhel9:2.4.20230630
$ docker pull $IMAGE --platform=linux/amd64

4.2. Generating data files by running the ansible-on-clouds-ops container

The following commands generate the required data file. These commands create a directory, and an empty data template that, when populated, is used during the upgrade.

Procedure

  1. Create a folder to hold the configuration files.

    $ mkdir command_generator_data
  2. Populate the $(pwd)/command_generator_data folder with the configuration file template.

    $ docker run --rm -v $(pwd)/command_generator_data:/data $IMAGE \
    command_generator_vars gcp_remove_extension_nodes \
    --output-data-file /data/extra_vars.yml

When you have run these commands, a command_generator_data/extra_vars.yml template file is created. This template file resembles the following:

gcp_add_extension_nodes:
  cloud_credentials_path:
  deployment_name:
  extra_vars:
    gcp_compute_region:
    gcp_instance_group_name:
    gcp_instance_template_name:

4.3. Populate the data file

You must populate the data file before triggering the operation. The variables listed in the data file are defined below.

  • cloud_credentials_path is the path for your Google Cloud service account credentials file. This must be an absolute path.
  • deployment_name is the name of the deployment for which you want to create an extension node.
  • gcp_instance_group_name is the name of the GCP instance group to create for the extension nodes.
  • gcp_instance_template_name is the name of the GCP instance template to create.
  • gcp_compute_region is the GCP region where the foundation deployment is deployed. This can be retrieved by checking the Deployments config in Deployment Manager.

4.4. Running the ansible-on-clouds-ops container to remove the extension nodes

Procedure

  1. To remove a set of extension nodes, run the command generator to generate the CLI command.

    $ docker run --rm -v $(pwd)/command_generator_data:/data $IMAGE command_generator --data-file /data/extra_vars.yml

    The command generator output provides the following command:

    d-----------------------------------------------
    Command to run playbook:
    
    docker run --rm --env PLATFORM=GCP -v </path/to/gcp/service-account.json>:/home/runner/.gcp/credentials:ro \
    --env ANSIBLE_CONFIG=../gcp-ansible.cfg --env DEPLOYMENT_NAME=<deployment_name> \
    --env GENERATE_INVENTORY=true $IMAGE redhat.ansible_on_clouds.gcp_remove_extension_nodes \
    -e 'gcp_deployment_name=<deployment_name> gcp_service_account_credentials_json_path=/home/runner/.gcp/credentials  gcp_compute_region=<region> gcp_instance_template_name=<instance_template_name> \
    gcp_instance_group_name=<instance_group_name>'
    ===============================================
  2. Run the supplied command to remove a set of extension nodes.

    $ docker run --rm --env PLATFORM=GCP -v </path/to/gcp/service-account.json>:/home/runner/.gcp/credentials:ro \
    --env ANSIBLE_CONFIG=../gcp-ansible.cfg --env DEPLOYMENT_NAME=<deployment_name> \
    --env GENERATE_INVENTORY=true  $IMAGE redhat.ansible_on_clouds.gcp_remove_extension_nodes \
    -e 'gcp_deployment_name=<deployment_name> gcp_service_account_credentials_json_path=/home/runner/.gcp/credentials  gcp_compute_region=<region> gcp_instance_template_name=<instance_template_name> \
    gcp_instance_group_name=<instance_group_name>'

If there are no errors, the extension node is removed successfully.