Running your EE

You can run your EE on the command line against localhost or a remote target using ansible-navigator.

> There are other tools besides ansible-navigator you can run EEs with.

Run against localhost

  1. Create a test_localhost.yml playbook.

    - name: Gather and print local facts
      hosts: localhost
      become: true
      gather_facts: true
      tasks:
    
       - name: Print facts
         ansible.builtin.debug:
          var: ansible_facts
    
  2. Run the playbook inside the postgresql_ee EE.

    ansible-navigator run test_localhost.yml --execution-environment-image postgresql_ee --mode stdout --pull-policy missing --container-options='--user=0'
    

You may notice the facts being gathered are about the container and not the developer machine. This is because the ansible playbook was run inside the container.

Run against a remote target

Before you start, ensure you have the following:

  • At least one IP address or resolvable hostname for a remote target.

  • Valid credentials for the remote host.

  • A user with sudo permissions on the remote host.

Execute a playbook inside the postgresql_ee EE against a remote host machine as in the following example:

  1. Create a directory for inventory files.

    mkdir inventory
    
  2. Create the hosts.yml inventory file in the inventory directory.

    all:
      hosts:
        192.168.0.2  # Replace with the IP of your target host
    
  3. Create a test_remote.yml playbook.

    - name: Gather and print facts
      hosts: all
      become: true
      gather_facts: true
      tasks:
    
       - name: Print facts
         ansible.builtin.debug:
          var: ansible_facts
    
  4. Run the playbook inside the postgresql_ee EE.

    Replace student with the appropriate username. Some arguments in the command can be optional depending on your target host authentication method.

    ansible-navigator run test_remote.yml -i inventory --execution-environment-image postgresql_ee:latest --mode stdout --pull-policy missing --enable-prompts -u student -k -K
    

See also

Execution Environment Definition

Provides information about the about Execution Environment definition file and available options.

Ansible Builder CLI usage

Provides details about using Ansible Builder.

Ansible Navigator documentation

Provides details about using Ansible Navigator.

Running a local container registry for EEs

This guide in the Ansible community forum explains how to set up a local registry for your Execution Environment images.