Lab activity
Ansible Navigator
Learn how to use Ansible Navigator to run playbooks and access module documentation while automating tasks on a managed RHEL host.
Overview
In this lab, you will learn how to use ansible-navigator as a modern command-line tool for running Ansible playbooks and accessing module documentation. You will configure connectivity to a managed host, install Ansible Navigator, create a simple playbook that deploys a marker file, and execute the playbook using ansible-navigator instead of ansible-playbook. You will also use Ansible Navigator to look up documentation for the copy module and verify that the playbook successfully made the required change on the managed host.
Learning Outcomes
- Install
ansible-navigatorusing Python pip. - Create a simple Ansible playbook for a managed host.
- Run a playbook using
ansible-navigator run. - Use stdout mode to display Navigator output directly in the terminal.
- Run Ansible Navigator using the local Ansible installation without an execution environment.
- Look up module documentation using
ansible-navigator doc. - Verify that a playbook executed through Ansible Navigator successfully changed the managed host.
Key Concepts
- Ansible Navigator: A command-line tool for running Ansible automation and accessing information about Ansible content.
- ansible-navigator run: Executes an Ansible playbook through Ansible Navigator.
- ansible-navigator doc: Displays documentation for Ansible modules directly from the command line.
- stdout Mode: Displays execution output directly in the terminal instead of opening Navigator's interactive interface.
- Execution Environment: An isolated environment that can contain Ansible and the dependencies required to execute automation content.
- Local Execution: Using
--execution-environment falseallows Navigator to use the locally installed Ansible environment instead of a container-based execution environment. - Fully Qualified Collection Name: A module name such as
ansible.builtin.copythat identifies both the collection and the module being used.
Why Needed?
- Modern Ansible Workflow: Provides hands-on experience running automation through Ansible Navigator instead of relying only on traditional Ansible commands.
- Quick Documentation Access: Allows module documentation to be accessed directly from the command line while developing playbooks.
- Flexible Execution: Supports both execution environments and locally installed Ansible environments.
- Efficient Playbook Testing: Stdout mode provides familiar terminal output that makes playbook execution easy to follow.
- Practical Verification: Verifying the resulting file on the managed host confirms that automation executed through Navigator produced the expected result.