Part 20 – AWX EE Containers and Ansible Navigator

So up until this point Ansible CLI (/etc/ansible) acted and stayed as my development workspace so I wrote playbooks under /etc/ansible/playbook so here there are no containers, no EE, just straight execution and it requires env lookups for credentials etc . Then we pushed it to GIt to Gitlab and AWX was polling from the gitlab.

ansible-playbook vm_deploy.yml -e “vm_name=test123”

But everything runs inside AWX runs as EE containers so from time to time we have an issue with yaml files not working well because community.general is not found in EE and community.vmware version has mismatch in AWX so we need a method to run the same EE container locally so what works in CLI works identically in AWX so we can just test in cli and just push to AWX.

One way to do this is by deploying a docker image with the same version of AWX EE so this allows us to test inside the exact same container AWX uses or use ansible-navigator

Using exact same container AWX

Pull the AWX EE image

docker pull quay.io/ansible/awx-ee:latest

Run playbooks inside the EE container exactly like AWX does

docker run --rm \
  -v /etc/ansible:/runner/project \
  -e VMWARE_HOST=vcenter.ash.local \
  -e VMWARE_USER=administrator@vsphere.local \
  -e VMWARE_PASSWORD=yourpassword \
  quay.io/ansible/awx-ee:latest \
  ansible-playbook /runner/project/playbooks/vm_deploy.yml \
  -e "vm_name=test123" \
  -e "size=small" \
  -e "network=vCF-Mgmt-VLAN-1611" \
  -e "datastore=NVMe-01" \
  -e "template_name=windows2022_template"

Ansible Navigator

This is the preferred approach now than using local EE containers. Navigator acts a local replacement for ansible-playbook but runs playbooks inside an Execution Environment container the same way AWX does from our CLI

Install the Ansible Navigator

pip install ansible-navigator --break-system-packages

Create ansible-navigator.yml in project root:

---
ansible-navigator:
  execution-environment:
    image: quay.io/ansible/awx-ee:latest
    pull:
      policy: missing
  mode: stdout
  playbook-artifact:
    enable: false

cat /etc/ansible/ansible-navigator.yml

ansible-navigator:
execution-environment:
image: quay.io/ansible/awx-ee:latest
pull:
policy: missing
mode: stdout
playbook-artifact:
enable: false
ansible:
inventories:
- /etc/ansible/inventory


Then instead of ansible-playbook we use

ansible-navigator run playbooks/vm_deploy.yml -e “vm_name=test123” -e “size=small”

(Visited 16 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.