Discrepancy Between Custom Image and AWX Execution Environment

,

Unusual behavior with custom EE.

Dear Community,

As part of AWX to gcloud connectivity I have built an image which has gcloud utility and set the PATH for the same.

Below lines are responsible for the same in my dockerfile.

RUN curl -O https://XXX.io/artifactory/ansible-store/google-cloud-sdk-470.0.0-linux-x86_64.tar.gz && \
    tar -xzf google-cloud-sdk-470.0.0-linux-x86_64.tar.gz && \
    ./google-cloud-sdk/install.sh --quiet && \
    rm google-cloud-sdk-470.0.0-linux-x86_64.tar.gz

# Add gcloud to PATH for all users
ENV PATH="/runner/google-cloud-sdk/bin:${PATH}"

The image build is successful and I have created a pod using the same and I can use gcloud commands there. For example


[root@test-connectivity-us runner] gcloud auth list --filter=status:ACTIVE --format="value(account)"
XXXXs-gke-gl-1.svc.id.goog
[root@test-connectivity-us runner]#

But when I use this image path in the custom execution environment, and in the playbook output it says

/bin/sh: line 1: gcloud: command not found

And hence I tried to find the directory during the execution
Can you please help me to understand what is happening here ?

Thanks and Regards
Saravana Selvaraj

@kurokobo , please have a look if you know how to fix this issue.

can you gather facts in the EE and show the output of ansible_env?

Sure @bcoca I am checking that,
Meanwhile in my awx-ee container which is running in awx-task has this entry
Exceeded retries for reading stdout


ERROR 2025/04/24 17:12:54 Exceeded retries for reading stdout /tmp/receptor/awx-task-5b5697bf6d-42zp2/awxtask5b5697bf6d42zp2bDtH0JID/stdout

WARNING 2025/04/24 17:12:54 Could not read in control service: read unix /var/run/receptor/receptor.sock->@: use of closed network connection

WARNING 2025/04/24 17:12:54 Could not close connection: close unix /var/run/receptor/receptor.sock->@: use of closed network connection

And this is the correct gather_facts

{
  "ansible_facts": {
    "ansible_date_time": {
      "year": "2025",
      "month": "04",
      "weekday": "Thursday",
      "weekday_number": "4",
      "weeknumber": "16",
      "day": "24",
      "hour": "18",
      "minute": "01",
      "second": "50",
      "epoch": "1745517710",
      "epoch_int": "1745517710",
      "date": "2025-04-24",
      "time": "18:01:50",
      "iso8601_micro": "2025-04-24T18:01:50.455595Z",
      "iso8601": "2025-04-24T18:01:50Z",
      "iso8601_basic": "20250424T180150455595",
      "iso8601_basic_short": "20250424T180150",
      "tz": "UTC",
      "tz_dst": "UTC",
      "tz_offset": "+0000"
    },
    "ansible_cmdline": {
      "BOOT_IMAGE": "/syslinux/vmlinuz.A",
      "init": "/usr/lib/systemd/systemd",
      "rootwait": true,
      "ro": true,
      "noresume": true,
      "loglevel": "7",
      "console": "ttyS0,115200",
      "security": "apparmor",
      "virtio_net.napi_tx": "1",
      "nmi_watchdog": "0",
      "csm.disabled": "0",
      "csm.pipe.enabled": "1",
      "csm.config.enabled": "1",
      ",firmware": true,
      "firmware_class.path": "/home/kubernetes/bin/nvidia/firmware",
      "module.sig_enforce": "0",
      "dm_verity.error_behavior": "3",
      "dm_verity.max_bios": "-1",
      "dm_verity.dev_wait": "1",
      "i915.modeset": "1",
      "cros_efi": true,
      "cos.disable_systemd_route_mgmt": true,
      "modules-load": "vfio-pci",
      "root": "/dev/dm-0",
      "\"dm-mod.create": "vroot,,,ro,0 4077568 verity 0 PARTUUID=026D5BB1-72C1-0A42-9B04-EB2BA01BB088 PARTUUID=026D5BB1-72C1-0A42-9B04-EB2BA01BB088 4096 4096 509696 509696 sha256 619d860ddd8a9524dafdf6b8ec88a36a664c05fe1bb0d9404a57d63c6a4c62ab c235c6c31383e961630d7f8051b4fc038d6c939eabd3c06e36cc68753b124955\"",
      "intel_iommu": "on,sm_on"
    },
    "ansible_proc_cmdline": {
      "BOOT_IMAGE": "/syslinux/vmlinuz.A",
      "init": "/usr/lib/systemd/systemd",
      "rootwait": true,
      "ro": true,
      "noresume": true,
      "loglevel": "7",
      "console": [
        "tty1",
        "ttyS0,115200"
      ],
      "security": "apparmor",
      "virtio_net.napi_tx": "1",
      "nmi_watchdog": "0",
      "csm.disabled": "0",
      "csm.pipe.enabled": "1",
      "csm.config.enabled": "1",
      ",firmware": true,
      "firmware_class.path": "/home/kubernetes/bin/nvidia/firmware",
      "module.sig_enforce": "0",
      "dm_verity.error_behavior": "3",
      "dm_verity.max_bios": "-1",
      "dm_verity.dev_wait": "1",
      "i915.modeset": "1",
      "cros_efi": true,
      "cos.disable_systemd_route_mgmt": true,
      "modules-load": "vfio-pci",
      "root": "/dev/dm-0",
      "\"dm-mod.create": "vroot,,,ro,0 4077568 verity 0 PARTUUID=026D5BB1-72C1-0A42-9B04-EB2BA01BB088 PARTUUID=026D5BB1-72C1-0A42-9B04-EB2BA01BB088 4096 4096 509696 509696 sha256 619d860ddd8a9524dafdf6b8ec88a36a664c05fe1bb0d9404a57d63c6a4c62ab c235c6c31383e961630d7f8051b4fc038d6c939eabd3c06e36cc68753b124955\"",
      "intel_iommu": "on,sm_on"
    },
    "ansible_system": "Linux",
    "ansible_kernel": "6.6.56+",
    "ansible_kernel_version": "#1 SMP PREEMPT_DYNAMIC Fri Jan 17 10:09:27 UTC 2025",
    "ansible_machine": "x86_64",
    "ansible_python_version": "3.9.17",
    "ansible_fqdn": "918541468e19",
    "ansible_hostname": "918541468e19",
    "ansible_nodename": "918541468e19",
    "ansible_domain": "",
    "ansible_userspace_bits": "64",
    "ansible_architecture": "x86_64",
    "ansible_userspace_architecture": "x86_64",
    "ansible_machine_id": "46bd04a7bd884367bbda4bae502f1482",
    "ansible_system_capabilities_enforced": "True",
    "ansible_system_capabilities": [
      "ep"
    ],
    "ansible_user_id": "root",
    "ansible_user_uid": 0,
    "ansible_user_gid": 0,
    "ansible_user_gecos": "root",
    "ansible_user_dir": "/root",
    "ansible_user_shell": "/bin/bash",
    "ansible_real_user_id": 0,
    "ansible_effective_user_id": 0,
    "ansible_real_group_id": 0,
    "ansible_effective_group_id": 0,
    "ansible_local": {},
    "ansible_dns": {
      "search": [
        "awx.svc.cluster.local",
        "svc.cluster.local",
        "cluster.local",
        "XXXXl-1.internal",
        "XXXXnternal",
        "google.internal"
      ],
      "nameservers": [
        "10.0.2.3",
        "10.223.104.10"
      ],
      "options": {
        "ndots": "5"
      }
    },
    "ansible_fips": false,
    "ansible_virtualization_type": "podman",
    "ansible_virtualization_role": "guest",
    "ansible_virtualization_tech_guest": [
      "podman",
      "container",
      "kvm"
    ],
    "ansible_virtualization_tech_host": [],
    "ansible_distribution": "CentOS",
    "ansible_distribution_release": "Stream",
    "ansible_distribution_version": "9",
    "ansible_distribution_major_version": "9",
    "ansible_distribution_file_path": "/etc/centos-release",
    "ansible_distribution_file_variety": "CentOS",
    "ansible_distribution_file_parsed": true,
    "ansible_os_family": "RedHat",
    "ansible_loadavg": {
      "1m": 77.52,
      "5m": 76.21,
      "15m": 65.16
    },
    "ansible_python": {
      "version": {
        "major": 3,
        "minor": 9,
        "micro": 17,
        "releaselevel": "final",
        "serial": 0
      },
      "version_info": [
        3,
        9,
        17,
        "final",
        0
      ],
      "executable": "/usr/bin/python3",
      "has_sslcontext": true,
      "type": "cpython"
    },
    "ansible_selinux_python_present": true,
    "ansible_selinux": {
      "status": "disabled"
    },
    "ansible_iscsi_iqn": "",
    "ansible_fibre_channel_wwn": [],
    "ansible_lsb": {},
    "ansible_processor": [
      "0",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "1",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "2",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "3",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "4",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "5",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "6",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "7",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "8",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "9",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "10",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "11",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "12",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "13",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "14",
      "AuthenticAMD",
      "AMD EPYC 7B12",
      "15",
      "AuthenticAMD",
      "AMD EPYC 7B12"
    ],
    "ansible_processor_count": 1,
    "ansible_processor_cores": 8,
    "ansible_processor_threads_per_core": 2,
    "ansible_processor_vcpus": 16,
    "ansible_processor_nproc": 16,
    "ansible_memtotal_mb": 64307,
    "ansible_memfree_mb": 10267,
    "ansible_swaptotal_mb": 0,
    "ansible_swapfree_mb": 0,
    "ansible_memory_mb": {
      "real": {
        "total": 64307,
        "used": 54040,
        "free": 10267
      },
      "nocache": {
        "free": 45294,
        "used": 19013
      },
      "swap": {
        "total": 0,
        "free": 0,
        "used": 0,
        "cached": 0
      }
    },
    "ansible_bios_date": "02/12/2025",
    "ansible_bios_vendor": "Google",
    "ansible_bios_version": "Google",
    "ansible_board_asset_tag": "38FDD88A-EFC1-145C-44E2-F5BE401BC06F",
    "ansible_board_name": "Google Compute Engine",
    "ansible_board_serial": "Board-GoogleCloud-38FDD88AEFC1145C44E2F5BE401BC06F",
    "ansible_board_vendor": "Google",
    "ansible_board_version": "NA",
    "ansible_chassis_asset_tag": "NA",
    "ansible_chassis_serial": "NA",
    "ansible_chassis_vendor": "Google",
    "ansible_chassis_version": "NA",
    "ansible_form_factor": "Other",
    "ansible_product_name": "Google Compute Engine",
    "ansible_product_serial": "GoogleCloud-38FDD88AEFC1145C44E2F5BE401BC06F",
    "ansible_product_uuid": "38fdd88a-efc1-145c-44e2-f5be401bc06f",
    "ansible_product_version": "NA",
    "ansible_system_vendor": "Google",
    "ansible_devices": {
      "loop1": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "sdb": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": "Google",
        "model": "PersistentDisk",
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "4096",
        "partitions": {},
        "rotational": "0",
        "scheduler_mode": "mq-deadline",
        "sectors": "4294967296",
        "sectorsize": "512",
        "size": "2.00 TB",
        "host": "",
        "holders": []
      },
      "loop6": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "loop4": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "loop2": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "loop0": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "dm-0": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "",
        "sectors": "4077568",
        "sectorsize": "4096",
        "size": "1.94 GB",
        "host": "",
        "holders": []
      },
      "loop7": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "sda": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": "Google",
        "model": "PersistentDisk",
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "4096",
        "partitions": {
          "sda4": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "53248",
            "sectors": "32768",
            "sectorsize": 512,
            "size": "16.00 MB",
            "uuid": null,
            "holders": []
          },
          "sda2": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "20480",
            "sectors": "32768",
            "sectorsize": 512,
            "size": "16.00 MB",
            "uuid": null,
            "holders": []
          },
          "sda12": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "249856",
            "sectors": "65536",
            "sectorsize": 512,
            "size": "32.00 MB",
            "uuid": null,
            "holders": []
          },
          "sda9": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "16450",
            "sectors": "1",
            "sectorsize": 512,
            "size": "512.00 Bytes",
            "uuid": null,
            "holders": []
          },
          "sda10": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "16451",
            "sectors": "1",
            "sectorsize": 512,
            "size": "512.00 Bytes",
            "uuid": null,
            "holders": []
          },
          "sda7": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "16449",
            "sectors": "1",
            "sectorsize": 512,
            "size": "512.00 Bytes",
            "uuid": null,
            "holders": []
          },
          "sda5": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "315392",
            "sectors": "4194304",
            "sectorsize": 512,
            "size": "2.00 GB",
            "uuid": null,
            "holders": []
          },
          "sda3": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": [
                "dm-0"
              ]
            },
            "start": "4509696",
            "sectors": "4194304",
            "sectorsize": 512,
            "size": "2.00 GB",
            "uuid": null,
            "holders": [
              "vroot"
            ]
          },
          "sda1": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "8704000",
            "sectors": "201011167",
            "sectorsize": 512,
            "size": "95.85 GB",
            "uuid": null,
            "holders": []
          },
          "sda11": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "64",
            "sectors": "16384",
            "sectorsize": 512,
            "size": "8.00 MB",
            "uuid": null,
            "holders": []
          },
          "sda8": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "86016",
            "sectors": "32768",
            "sectorsize": 512,
            "size": "16.00 MB",
            "uuid": null,
            "holders": []
          },
          "sda6": {
            "links": {
              "ids": [],
              "uuids": [],
              "labels": [],
              "masters": []
            },
            "start": "16448",
            "sectors": "1",
            "sectorsize": 512,
            "size": "512.00 Bytes",
            "uuid": null,
            "holders": []
          }
        },
        "rotational": "1",
        "scheduler_mode": "bfq",
        "sectors": "209715200",
        "sectorsize": "512",
        "size": "100.00 GB",
        "host": "",
        "holders": []
      },
      "loop5": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      },
      "loop3": {
        "virtual": 1,
        "links": {
          "ids": [],
          "uuids": [],
          "labels": [],
          "masters": []
        },
        "vendor": null,
        "model": null,
        "sas_address": null,
        "sas_device_handle": null,
        "removable": "0",
        "support_discard": "0",
        "partitions": {},
        "rotational": "1",
        "scheduler_mode": "none",
        "sectors": "0",
        "sectorsize": "512",
        "size": "0.00 Bytes",
        "host": "",
        "holders": []
      }
    },
    "ansible_device_links": {
      "ids": {},
      "uuids": {},
      "labels": {},
      "masters": {
        "sda3": [
          "dm-0"
        ]
      }
    },
    "ansible_uptime_seconds": 716285,
    "ansible_lvm": "N/A",
    "ansible_mounts": [],
    "ansible_is_chroot": false,
    "ansible_hostnqn": "",
    "ansible_apparmor": {
      "status": "disabled"
    },
    "ansible_pkg_mgr": "dnf",
    "ansible_service_mgr": "dumb-init",
    "gather_subset": [
      "all"
    ],
    "module_setup": true
  },
  "warnings": [],
  "deprecations": [],
  "_ansible_verbose_override": true,
  "_ansible_no_log": false,
  "changed": false
}

Sorry my bad I shared a wrong one earlier.

This is the correct one for the EE i am looking for ,

ansible_env is

{
  "ansible_env": {
    "PROJECT_REVISION": "1c33bb8c196e535921693c3782552cb7f55a93ca",
    "ANSIBLE_BASE_ORGANIZATION_MODEL": "main.Organization",
    "AWX_HOST": "https://towerhost",
    "HOSTNAME": "918541468e19",
    "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False",
    "INVENTORY_ID": "10",
    "MAX_EVENT_RES": "700000",
    "ANSIBLE_COLLECTIONS_PATHS": "/runner/requirements_collections:~/.ansible/collections:/usr/share/ansible/collections",
    "PWD": "/runner/project",
    "gcp_sa_json": "/runner/env/tmp9hityef7",
    "RUNNER_ONLY_FAILED_EVENTS": "False",
    "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True",
    "AWX_PRIVATE_DATA_DIR": "/tmp/awx_3594_q102zb6d",
    "gcp_sa_user_id": "XXXXX@01.iam.gserviceaccount.com",
    "ANSIBLE_BASE_TEAM_MODEL": "main.Team",
    "_": "/usr/bin/python3",
    "container": "podman",
    "AWX_ISOLATED_DATA_DIR": "/runner/artifacts/3594",
    "HOME": "/root",
    "ANSIBLE_COLLECTIONS_PATH": "/runner/requirements_collections:~/.ansible/collections:/usr/share/ansible/collections",
    "ANSIBLE_FACT_CACHE_TIMEOUT": "0",
    "ANSIBLE_FORCE_COLOR": "True",
    "ANSIBLE_STDOUT_CALLBACK": "awx_display",
    "ANSIBLE_CALLBACK_PLUGINS": "/runner/artifacts/3594/callback",
    "ANSIBLE_UNSAFE_WRITES": "1",
    "TERM": "xterm",
    "SHLVL": "1",
    "RUNNER_OMIT_EVENTS": "False",
    "ANSIBLE_SSH_CONTROL_PATH_DIR": "/runner/cp",
    "ANSIBLE_RETRY_FILES_ENABLED": "False",
    "ANSIBLE_ROLES_PATH": "/runner/requirements_roles:~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles",
    "LC_CTYPE": "C.UTF-8",
    "ANSIBLE_HOST_KEY_CHECKING": "False",
    "PATH": "/runner/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "JOB_ID": "3594"
  },
  "_ansible_verbose_always": true,
  "_ansible_no_log": false,
  "changed": false
}
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

The path is not set to include the cloud utilities for the Ansible user, this is probably due to Ansible executing as ‘non interactive’, so you can either fix this in the environment or add it via the environment keyword in the play.

Sorry for the confusion here, I shared the latest ansible_env which has gcloud path if you can see
and the PATH is

 "PATH": "/runner/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",

And it is coming as expected. Looks like the utility is not correctly getting installed.
I am using this method to install gcloud in my dockerfile . Is this correct ?

RUN curl -O https://XXX.uXXs-east1.infra.int.gw.XXX.io/artifactory/ansible-store/google-cloud-sdk-470.0.0-linux-x86_64.tar.gz && \
    tar -xzf google-cloud-sdk-470.0.0-linux-x86_64.tar.gz && \
    ./google-cloud-sdk/install.sh --quiet && \
    rm google-cloud-sdk-470.0.0-linux-x86_64.tar.gz

When you run a job in the execution environment it is bind mounted to /runner and there the /runner/google-cloud-sdk directory is lost behind the bind mount. This can be seen when running ansible-navigator exec and browsing to /runner. You’ll see an artifacts and projects directory.

A simple change is to move your installation of the SDK to a different directory. I personally tested extracting it to /google-cloud-sdk. It is probably more sensible to place it in /opt/google-cloud-sdk though.

FROM ghcr.io/ansible-community/community-ee-base:2.18.4-1

USER root

WORKDIR /

RUN cd / && curl --verbose --output google-cloud-cli-linux-x86_64.tar.gz \
  https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz && \
  tar xzf google-cloud-cli-linux-x86_64.tar.gz && \
  ./google-cloud-sdk/install.sh --quiet && \
  rm google-cloud-cli-linux-x86_64.tar.gz && cd -

ENV PATH="/google-cloud-sdk/bin:${PATH}"

WORKDIR /runner

USER 1000

Thanks for the response. Yes that makes sense to keep it in /opt I will test this today and will let you know if that works.

Thanks and Best Regards

1 Like

Thank you so much @wayt the solution works and I am able to install gcloud in /opt/
And @bcoca thanks to you as well in responding to my post.

1 Like