What Is Ansible Navigator and How Do You Install It on RHEL 9?

Ansible Navigator is a graphical user interface (GUI) tool for Ansible automation that allows users to manage and configure their Ansible environments using a visual interface. It provides a simplified view of Ansible's automation capabilities, allowing users to quickly and easily create, edit, and run Ansible playbooks, inventories, and variables.

Mar 23, 2023 - 08:06
Updated: 7 days ago
105.4k
What Is Ansible Navigator and How Do You Install It on RHEL 9?

Quick answer: Ansible Navigator is a text-based terminal tool for running and inspecting Ansible content, usually inside containers called execution environments. It has no web interface. On RHEL 9, install it with sudo dnf install ansible-navigator after enabling the Ansible Automation Platform repository, or install it with pip in a virtual environment. It also needs Podman for execution environments.

Key takeaways

  • Ansible Navigator is not in EPEL and it is not a web GUI. It runs in your terminal, with an optional interactive text interface (TUI).
  • Two install routes: the RPM from Red Hat's Ansible Automation Platform repository (needs a subscription), or pip inside a Python virtual environment (no subscription).
  • By default it runs playbooks inside an execution environment container, so you also need Podman and an image to pull.
  • If you do not want containers, run with --execution-environment false or --ee false and --mode stdout to behave like ansible-playbook.

What Ansible Navigator is

Ansible Navigator is a command-line tool that replaces and combines several older commands: ansible-playbook, ansible-doc, ansible-inventory, ansible-config and others. Its main features are:

  • An interactive text user interface that lets you browse playbook runs, tasks, hosts, collections and module documentation using the keyboard.
  • A standard stdout mode that prints results as ordinary commands do, which suits scripts and CI.
  • Support for execution environments (EEs): container images that package ansible-core, collections and their Python dependencies, so a playbook runs the same on any machine.
  • Replay of past runs from saved artifact files, which helps when you debug a failure.

Official documentation is at ansible.readthedocs.io/projects/navigator. The wider Ansible documentation describes execution environments in more detail.

Two common mistakes are worth ruling out early: it does not open a GUI in your browser, and it is not installed from EPEL. The correct steps follow.

Before you install

  • An RHEL 9 system (or Rocky Linux or AlmaLinux 9) with a user that has sudo.
  • For the RPM route, a Red Hat subscription that includes Ansible Automation Platform, and the system registered with subscription-manager.
  • For the pip route, a Python version supported by the Navigator release you want. RHEL 9's default Python is 3.9, and recent Navigator releases may need a newer one. Check the project's requirements and, if needed, install a newer interpreter such as python3.11 from the AppStream repository.
  • Podman for execution environments: sudo dnf install podman.

Option 1: install from the Red Hat repository

  1. Register the system and attach a subscription that includes Ansible Automation Platform.
    sudo subscription-manager register
    sudo subscription-manager list --available --matches "*Ansible Automation Platform*"
  2. Enable the repository for your Ansible Automation Platform release. The name contains the release number, so confirm it in the Red Hat documentation before you run the command.
    sudo subscription-manager repos --enable ansible-automation-platform-2.x-for-rhel-9-x86_64-rpms
    Replace 2.x with the release you have access to.
  3. Install the package.
    sudo dnf install ansible-navigator
  4. Check it.
    ansible-navigator --version

Red Hat's own documentation at docs.redhat.com lists the exact repository names and the supported execution environment images for each release.

Option 2: install with pip in a virtual environment

This route needs no subscription and is the usual one for learning labs. Do not use sudo pip, because it can break system packages that RHEL tools depend on.

sudo dnf install python3.11 python3.11-pip podman
python3.11 -m venv ~/venvs/navigator
source ~/venvs/navigator/bin/activate
pip install ansible-navigator
ansible-navigator --version

If your release works with the default Python 3.9, use python3 -m venv instead. Next time, run source ~/venvs/navigator/bin/activate before using the tool.

First run

Create a tiny playbook, hello.yml:

---
- name: Navigator test
 hosts: localhost
 gather_facts: false
 tasks:
 - name: Say hello
 ansible.builtin.debug:
 msg: "Navigator works"

Now run it in the way that matches your setup.

# Without containers, printing output like ansible-playbook
ansible-navigator run hello.yml --execution-environment false --mode stdout

# With the default container behaviour and the interactive interface
ansible-navigator run hello.yml

The second command pulls an execution environment image the first time, which can take a while. Pulling from Red Hat's registry needs a login first with podman login registry.redhat.io. Inside the interface, type a task number to open its detail, and press the Esc key to go back. Type :q to quit.

Useful commands to try next

CommandWhat it does
ansible-navigator doc ansible.builtin.copyShows module documentation, like ansible-doc
ansible-navigator collectionsLists collections available in the execution environment
ansible-navigator imagesLists and inspects execution environment images
ansible-navigator inventory -i inventoryBrowses an inventory interactively
ansible-navigator configShows the Ansible configuration in effect
ansible-navigator replay artifact.jsonReplays a saved run

Troubleshooting

  • "No match for argument: ansible-navigator": the repository is not enabled, or the system has no entitlement. EPEL does not provide it. Check subscription-manager repos --list-enabled, or use the pip route.
  • Image pull fails with an authentication error: run podman login registry.redhat.io with your Red Hat account, or choose an image you can pull without login.
  • Permission errors with Podman: run Navigator as a normal user with rootless Podman, not as root, unless you know why you need root.
  • Python version errors with pip: use a newer interpreter in the virtual environment, as above.
  • Playbook cannot see your files: inside an execution environment only mounted paths exist. Run from your project directory and avoid absolute paths outside it.

Where this matters for exams and jobs

Red Hat's current automation training and the Ansible Automation Platform use execution environments and Navigator, so it is worth knowing. Which tool a particular Red Hat exam expects can change between versions, so read the objectives on Red Hat's training and certification site for your exam rather than assuming.

Next steps

If you are new to package management on RHEL, read Linux package managers: APT, YUM and DNF. For guided Ansible practice, see our RHCE EX294 course.

Related reading

Frequently Asked Questions

It is a command-line tool with an optional text interface for running and inspecting Ansible content. It runs playbooks inside execution environment containers by default and can replace ansible-playbook, ansible-doc and related commands.

No. On RHEL it comes from the Red Hat Ansible Automation Platform repository, which needs a subscription, or from PyPI using pip. Installing epel-release does not provide the package.

Enable your Ansible Automation Platform repository with subscription-manager and run sudo dnf install ansible-navigator. Without a subscription, create a Python virtual environment and run pip install ansible-navigator, with Podman installed for execution environments.

No. It runs in the terminal. It offers an interactive text user interface for browsing runs, tasks and docs, and a plain stdout mode. The web interface in the Ansible product line is the automation controller.

Only for execution environments, which is the default mode. Podman is the usual choice on RHEL. You can skip containers by running with --execution-environment false and --mode stdout.

It is a container image that bundles ansible-core, collections and Python dependencies, so playbooks run the same everywhere. Navigator pulls and runs the image for you when you run a playbook.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Aayushi Sinha

With a passion for staying on the cutting edge of technology trends, I am dedicated to delivering content that not only informs but also inspires. Whether you need in-depth analysis pieces, informative guides, or thought-provoking opinion pieces, I craft content that resonates with tech enthusiasts and professionals alike.