In this chapter we will use the execution environment on the command line.
You should have built your execution environment ee-ansible-demo
- if not, please go back to the previous chapter.
Before we push a custom EE to a registry and use it in automation controller we want to make sure it provides what we need to run our Playbooks with all dependencies. Basically check if it works… :-)
For this we run a Playbook in the runtime environment the EE provides. Because ansible-playbook
can’t do this, we need to use the second new tool on the block, ansible-navigator
:
ansible-navigator
to use the previously created EE either by
.ansible-navigator.yml
configuration file in your home directorySpecify the name of the execution environment image
in the output of ansible-navigator --help
.~/.ansible-navigator.yaml
dot-file and add this content:---
ansible-navigator:
execution-environment:
image: ee-ansible-demo:0.1.0
ansible-navigator
and start to explore its features. Navigating is straight forward, first check the ee-ansible-demo
EE contains the containers.podman
collection:
:collections
on the start page. ESC
always takes you back one step in the menu structure.Then have a look at the included EE images:
:images
, choose an image by typing the row numberESC
is your friend when you got lost in menus items…ansible-navigator
Now we finally want to run a Playbook to test the new EE. The demo Playbook you used before in automation controller is part of the GitHub repo ee-flow
you checked out already. So we just need an inventory to go with it.
~/ee-flow/ansible-builder/lab_inventory.ini
. The result should look something like this (get the FQDN from the dynamic inventory in automation controller):[managed_nodes]
node2 ansible_host=<node 2 FQDN> ansible_user=ec2-user
You can find the FQDN of node 2 in Hosts menu of automation controller and the “public_dns_name” attribute of the host.
ansible-navigator
and run the Playbook:
:run ~/ee-flow/deploy-container.yml -i ~/ee-flow/ansible-builder/lab_inventory.ini
deploy httpd container
, this will bring you to the task list from where you can inspect the running tasks.ansible-navigator
with multiple ESC
, or if you’re a vi fan with ‘:q’.# you can find the FQDN of the instance in your automation controller in the **Hosts** menu
$ curl <node 2 FQDN>
Welcome to Ansible LearnFest!
There is a command line parameter in ansible-navigator
that makes the run and output mimic ansible-playbook
, and is not jumping into the TUI interface. Give it a try:
ansible-navigator run ~/ee-flow/deploy-container.yml -i ~/ee-flow/ansible-builder/lab_inventory.ini -m stdout
ansible-navigator
to inspect and run a Playbook in a custom EE.