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-opscontainer image will run) - Docker
Steps
-
Pull the
ansible-on-clouds-opscontainer image. - Generate data files by running the ansible-on-clouds-ops container.
- Update the data file.
-
Run the
ansible-on-clouds-opscontainer 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.
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
Create a folder to hold the configuration files.
$ mkdir command_generator_data
Populate the
$(pwd)/command_generator_datafolder 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_pathis the path for your Google Cloud service account credentials file. This must be an absolute path. -
deployment_nameis the name of the deployment for which you want to create an extension node. -
gcp_instance_group_nameis the name of the GCP instance group to create for the extension nodes. -
gcp_instance_template_nameis the name of the GCP instance template to create. -
gcp_compute_regionis 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
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>' ===============================================
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.