m8ram
Mission Specialist
Mission Specialist
  • 274 Views

Question on setting the path to the ansible configuration file

In the guided exercise "Guided Exercise: Configuring Automation Content Navigator" (chapter 4.04) the solution to set the path to the configuration file is to use an ENV var in the execution-environment section.

However based on previous examples of the ansible-navigator.yml file and https://access.redhat.com/documentation/en-us/red_hat_ansible_automation_platform/2.0-ea/html/ansibl... I was under the impression that the following would all have the same result:

CLI: -c or --config

ENV: ANSIBLE_CONFIG

Settings file:

 

 

 

ansible-navigator:
  ansible:
    config:
      path: ./ansible.cfg

 

 

However the settings file option does not work in my tests.

Can someone explain the difference between these options and why setting the path in the ansible config section does not work?

Update:
Another test shows that renaming ansible.cfg and updating the ansible-navigator.yml to match does not work.

The configuration in several exercises is:

$ grep path ansible-navigator.yml
      path: ./ansible.cfg
$ ls -l ansible.cfg
-rw-rw-r--. 1 student student 144 Feb 14 08:39 ./ansible.cfg

Which works, however renaming the file breaks:

$ mv ansible{,1}.cfg
$ sed -i 's/ansible.cfg/ansible1.cfg/' ansible-navigator.yml
$ grep path ansible-navigator.yml
      path: ./ansible1.cfg
$ ls -l ansible.cfg
-rw-rw-r--. 1 student student 144 Feb 14 08:39 ./ansible1.cfg

 

0 Kudos
2 Replies
wbialy
Flight Engineer Flight Engineer
Flight Engineer
  • 249 Views

I remember having similar challenges when using the --senv cli option. It turned out that I had a wrong path assigned to the ANSIBLE_CONFIG variable. In that case ansible-navigator does not warn nor throw an error. It takes the next available configuration it can find.


It migh be worth rechecking your paths.


All in all the above mentioned options are definitively working, hoverver when the path is set both via envs and ansible-navigator.yml I have observed that the ansible-navigator config returns value set in the yml as the current config value oppose to the one set via env as specified in the documentation proceeding order (https://ansible.readthedocs.io/projects/navigator/faq/#what-is-the-order-in-which-configuration-sett...).

0 Kudos
m8ram
Mission Specialist
Mission Specialist
  • 235 Views

Thank you, I'll definitely double check.

I was able to reproduce the issue in various exercises. With full and relative paths and even when copy/pasting the ENV var path to the ansible > config section.

0 Kudos
Join the discussion
You must log in to join this conversation.