---
# System prepended metadata

title: 3. Deploying an extension node

---

The foundation deployment is deployed with two automation controller nodes and one automation hub node by default. You can add execution nodes to scale out Ansible Automation Platform from GCP Marketplace. Extension node offers can be mixed and matched together to scale up and out the Ansible Automation Platform deployment.

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

The procedure contains the following steps:

1. Decide the offer type for the extension nodes.

2. Pull the `ansible-on-clouds-ops` container image.

3. Ensure the minimum permissions are met to manage extension nodes.

4. Generate data files by running the `ansible-on-clouds-ops` container.

5. Update the data file.

6. Run the `ansible-on-clouds-ops` container to deploy extension nodes.

Prerequisite

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

**3.1 Deciding the offer type**

The following table lists the offer types and the corresponding GCP instance types. Depending on the workload needs, you can choose a more suitable offer type for the extension nodes.


| Offer Type | GCP Instance Type |
| -----------| ----------------- |
| 100        | n2-standard-2     | 
| 200        | n2-standard-4     |
| 400        | n2-standard-8     |


**3.2 IAM Permissions**
Your GCP account must have the following Identity and Access Management (IAM) permissions to successfully create and manage extension nodes on Ansible Automation Platform.

Your GCP account must also be licensed to deploy Extension node offer for Ansible Automation Platform from GCP marketplace. 

Minimum Permissions - 
* Cloud SQL Client 
* Cloud SQL Instance User
* Editor
* Logs Writer
* Secret Manager Secret Accessor
* IAP-secured Tunnel User


**3.3 Pulling the ansible-on-clouds-ops container image**

Pull the Docker image for the Ansible on Clouds operational container with the same tag as the version you are deploying to.

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, see link:https://access.redhat.com/RegistryAuthentication[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-rhel8:2.4.20230630
$ docker pull $IMAGE --platform=linux/amd64
```

For EMEA regions (Europe, Middle East, Africa) run the following command instead:

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


**3.4 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 deployment of the extension nodes.

Procedure

1. Create a folder to hold the configuration files.
    ```
    $ mkdir command_generator_data
    ```

2. Populate the `command_generator_data` folder with the configuration file template.
    ```
    $ docker run --rm -v $(pwd)/command_generator_data:/data $IMAGE \
        command_generator_vars gcp_add_extension_nodes \
        --output-data-file /data/extra_vars.yml
    ```

3. 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_extension_node_subscription:
    gcp_instance_group_name:
    gcp_instance_template_name:
    gcp_offer_type:

```

**3.5 Update 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 AAP deployment manager 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_offer_type` is the offer type of the extension node. This must be `100`, `200` or `400`.
* `gcp_compute_region` is GCP region where the foundation deployment is deployed. This can be retrieved by checking the Deployments config in Deployment Manager.
* `gcp_extension_node_subscription` is the flag to confirm whether extension node subscription is purchased. Must be `<true/false>`

**3.6 Deploying the extension node**

Procedure
1. To deploy the 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
```
Provides the following command:

```
-----------------------------------------------
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 DEPLO
YMENT_NAME=<deployment_name> --env GENERATE_INVENTORY=true  $IMAGE redhat.ansible_on_clouds.gcp_add_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> gcp_offer_type=100 gcp_extension_node_subscription=True'
===============================================
```
2. Run the supplied command to add the 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=leena1 --env GENERATE_INVENTORY=true  $IMAGE redhat.ansible_on_clouds.gcp_add_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> gcp_offer_type=100 gcp_extension_node_subscription=True'
```
3. When the playbook has finished running, the output resembles the following:
```
TASK [redhat.ansible_on_clouds.standalone_gcp_add_extension_nodes : [deploy_extension_nodes] Extension node created] ***
ok: [localhost] => {
    "msg": "Extension node is created for deployment test-ext1."
}

PLAY RECAP *********************************************************************
localhost                  : ok=39   changed=5    unreachable=0    failed=0    skipped=6    rescued=0    ignored=0
```
