Use automation content navigator to run a playbook and review the results of its execution.
Outcomes
Use automation content navigator to run a playbook.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command creates an Ansible project in the /home/student/develop-navigator/ directory.
[student@workstation ~]$ lab start develop-navigator
Procedure 1.1. Instructions
Install the ansible-navigator package.
[student@workstation ~]$sudo yum install ansible-navigator[sudo] password for student:student...output omitted...
Review the exercise playbook.
Change to the /home/student/develop-navigator/ directory.
[student@workstation ~]$ cd ~/develop-navigator/Use the tree command to view the files in the directory.
[student@workstation develop-navigator]$ tree
.
├── ansible.cfg
├── intranet.yml
└── inventory
0 directories, 3 filesReview the intranet.yml playbook.
---
- name: Enable intranet services
hosts: servera.lab.example.com
become: true
tasks:
- name: latest version of httpd and firewalld installed
ansible.builtin.yum:
name:
- httpd
- firewalld
state: latest
- name: test html page is installed
ansible.builtin.copy:
content: "Welcome to the example.com intranet!\n"
dest: /var/www/html/index.html
- name: firewalld enabled and running
ansible.builtin.service:
name: firewalld
enabled: true
state: started
- name: firewalld permits http service
ansible.posix.firewalld:
service: http
permanent: true
state: enabled
immediate: true
- name: httpd enabled and running
ansible.builtin.service:
name: httpd
enabled: true
state: started
- name: Test intranet web server
hosts: localhost
become: false
tasks:
- name: connect to intranet web server
ansible.builtin.uri:
url: http://servera.lab.example.com
return_content: true
status_code: 200Run the intranet.yml playbook using automation content navigator.
Automation content navigator needs to pull the container image for its automation execution environment to your workstation from an automation hub or other container registry.
Use the podman login command to log in to the classroom private automation hub at hub.lab.example.com.
Use student as your username and redhat123 as your password.
(If you did not have a private automation hub, but had internet access, you could use your Customer Portal account to log in to the automation hub hosted by Red Hat at registry.redhat.io instead.)
[student@workstation develop-navigator]$podman login hub.lab.example.comUsername:studentPassword:redhat123Login Succeeded!
Use the ansible-navigator run intranet.yml -m stdout --eei ee-supported-rhel8 command to run the intranet.yml playbook.
The output presented by stdout mode is in the same format as output presented by the ansible-playbook command.
[student@workstation develop-navigator]$ansible-navigator run intranet.yml \>-m stdout --eei ee-supported-rhel8------------------------------------------------------------ Execution environment image and pull policy overview ------------------------------------------------------------ Execution environment image name: ee-supported-rhel8:latest Execution environment image tag: latest Execution environment pull arguments: None Execution environment pull policy: tag Execution environment pull needed: True ------------------------------------------------------------ Updating the execution environment ------------------------------------------------------------ Running the command: podman pull ee-supported-rhel8:latest Trying to pull hub.lab.example.com/ee-supported-rhel8:latest... Getting image source signatures Copying blob 3cbba8687c73 skipped: already exists Copying blob 978c7c1baf28 skipped: already exists Copying blob 858b1db62e17 skipped: already exists Copying blob 91181fe42f7e skipped: already exists Copying blob 4ace973aa1b1 skipped: already exists Copying config c33e10e995 done Writing manifest to image destination Storing signatures c33e10e995298d65bad08da35d7cd0beb660a2fe824aef460aebe14f889905d3 PLAY [Enable intranet services] ************************************************ TASK [Gathering Facts] ********************************************************* ok: [servera.lab.example.com] TASK [latest version of httpd and firewalld installed] ************************* changed: [servera.lab.example.com] TASK [test html page is installed] ********************************************* changed: [servera.lab.example.com] TASK [firewalld enabled and running] ******************************************* ok: [servera.lab.example.com] TASK [firewalld permits http service] ****************************************** changed: [servera.lab.example.com] TASK [httpd enabled and running] *********************************************** changed: [servera.lab.example.com] PLAY [Test intranet web server] ************************************************ TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [connect to intranet web server] ****************************************** ok: [localhost] PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 ... failed=0 skipped=0 ... servera.lab.example.com : ok=6 changed=4 ... failed=0 skipped=0 ...
Using the ee-supported-rhel8 execution environment, run the intranet.yml playbook interactively from within automation content navigator.
Use the ansible-navigator command to launch automation content navigator.
[student@workstation develop-navigator]$ansible-navigator \>--eei ee-supported-rhel8
0│Welcome 1│----------------------------------------------------------------------------- 2│ 3│Some things you can try from here: 4│-:collectionsExplore available collections 5│-:configExplore the current ansible config 6│-:doc <plugin>Review documentation for a module 7│-:helpShow the main help page 8│-:imagesExplore execution environment imag 9│-:inventory -i <inventory>Explore an inventory 10│-:logReview the application log 11|-:lint <file or directory>Lint Ansible/YAML files (experimen 12│-:openOpen current page in the editor 13│-:replayExplore a previous run using a pla 14│-:run <playbook> -i <inventory>Run a playbook in interactive mode 15|-:settingsReview the current ansible-navigat 16│-:quitQuit the application 17│ 18│happy automating, 19│ 20│-winston
Type :run intranet.yml to interactively run the intranet.yml playbook.
Play name Ok Changed ... Failed Skipped Ignored ... Task count Progress 0│Enable in 6 0 ... 0 0 0 ... 6 Complete 1│Test intr 2 0 ... 0 0 0 ... 2 Complete ^f/PgUp page up ^b/PgDn page down ↑↓ scroll esc back ... SUCCESSFUL
Type 0 to display details for the Enable intranet services play.
Result Host Number Changed Task ... 0│OK servera 0 False Gathering Facts ... 1│OK servera 1 False latest version of httpd and firewalld ... 2│OK servera 2 False test html page is installed ... 3│OK servera 3 False firewalld enabled and running ... 4│OK servera 4 False firewalld permits http service ... 5│OK servera 5 False httpd enabled and running ... ^f/PgUp page up ^b/PgDn page down ↑↓ scroll esc back ... SUCCESSFUL
Press ESC to return to the main playbook summary page, and then type 1 to display details for the Test intranet web server play.
Result Host Number Changed Task Task action ... 0│OK localhost 0 False Gathering Facts gather_facts ... 1│OK localhost 1 False connect to intranet ... ansible.built ... ^f/PgUp page up ^b/PgDn page down ↑↓ scroll esc back ... SUCCESSFUL
Type :q to exit the ansible-navigator command.