Browse the current configuration settings for running Ansible Playbooks by using automation content navigator.
Outcomes
Use the ansible-navigator command to review your current Ansible configuration.
Compare your custom configuration to default Ansible settings.
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/config-ansible directory.
[student@workstation ~]$ lab start config-ansible
Procedure 4.1. Instructions
Use automation content navigator to browse the current configuration and determine which settings use their default values.
Use the ansible-navigator config command.
[student@workstation ~]$ansible-navigator config \>--eei hub.lab.example.com/ee-supported-rhel8 --pp missing
You can explore the current configuration settings for automation content navigator.
Name Default Source Current
0│Action warnings True default True
1│Agnostic become prompt True default True
2│Allow world readable tmpfiles True default False
3│Ansible connection path True default None
...output omitted...Search for the Default host list option.
Type :f host and then press Enter.
Name Default Source Current
0│Default host list True default ['/etc/ansible/hosts']
1│Display skipped hosts True default True
...output omitted...Notice that line 0 in your terminal output is green and the value in the Default column is True, indicating that it is a default setting.
Press 0 to view more details for the Default host list option.
Default host list (current/default: ['/etc/ansible/hosts']) 0│--- 1│current_config_file: None 2│current_value: 3│- /etc/ansible/hosts 4│default: true 5│default_value: /etc/ansible/hosts 6│description: Comma separated list of Ansible inventory sources 7│env: 8│- name: ANSIBLE_INVENTORY 9│expand_relative_paths: true 10│ini: 11│- key: inventory 12│ section: defaults 13│name: Default host list 14│option: DEFAULT_HOST_LIST 15│source: default 16│type: pathlist 17│via: default 18│yaml: 19│ key: defaults.inventory
Exit from ansible-navigator by pressing ESC twice, or type :q and then press Enter.
Customize your current Ansible configuration and use automation content navigator to identify some changes that you made to the default settings.
Ansible configuration settings specified within an ansible.cfg file in your current directory take precedence over the default Ansible configuration settings.
Change to the /home/student/config-ansible directory and review the ansible.cfg configuration file.
[student@workstation ~]$cd ~/config-ansible[student@workstation config-ansible]$cat ansible.cfg[defaults] inventory=inventory remote_user=devops
Use the ansible-navigator config command.
[student@workstation config-ansible]$ansible-navigator config \>--eei hub.lab.example.com/ee-supported-rhel8 --pp missing
Search for the Default host list option again.
Type :f host and then press Enter.
Name Default Source Current
0│Default host list False /home/student/config-a['/home/student/config-
1│Display skipped hosts True default True
...output omitted...Notice that line 0 in your terminal output is yellow and the value in the Default column is False, indicating that it is not a default setting.
This time the Default host list option has the following displayed values:
| Field | Value |
|---|---|
False
| |
/home/student/config-ansible/ansible.cfg
| |
['/home/student/config-ansible/inventory']
|
Press 0 to view more details for the Default host list option in the custom configuration.
Default host list (current: ['/home/student/config-ansible/inventory']) ... 0│--- 1│current_config_file: /home/student/config-ansible/ansible.cfg 2│current_value: 3│- /home/student/config-ansible/inventory 4│default: false 5│default_value: /etc/ansible/hosts 6│description: Comma separated list of Ansible inventory sources 7│env: 8│- name: ANSIBLE_INVENTORY 9│expand_relative_paths: true 10│ini: 11│- key: inventory 12│ section: defaults 13│name: Default host list 14│option: DEFAULT_HOST_LIST 15│source: /home/student/config-ansible/ansible.cfg 16│type: pathlist 17│via: /home/student/config-ansible/ansible.cfg 18│yaml: 19│ key: defaults.inventory
Exit from the ansible-navigator command by typing :q and then pressing Enter.
Use automation content navigator to search for a specific configuration setting, determine if the setting is customized, and discover the source of any customizations.
Use the ansible-navigator config command.
[student@workstation config-ansible]$ansible-navigator config \>--eei hub.lab.example.com/ee-supported-rhel8 --pp missing
Search for the Default ask pass setting.
Type :f ask and then press Enter.
Name Default Source Current
0│Default ask pass True default False
1│Default ask vault pass True default False
...output omitted...Notice that line 0 in your terminal output is green and the value in the Default column is True.
This means that the displayed values are the default settings for the Default ask pass option.
Type :q and then press Enter to exit from the ansible-navigator command.
In the ansible.cfg file, add the ask_pass=false line to the [defaults] section.
The resulting ansible.cfg file has the following content.
[defaults]
inventory=inventory
remote_user=devops
ask_pass=falseUse the ansible-navigator config command again and search for the Default ask pass setting.
Type :f ask and then press Enter.
Name Default Source Current
0│Default ask pass False /home/student/config-ansible/a False
1│Default ask vault pass True default False
...output omitted...Notice that line 0 in your terminal output is yellow and the value in the Default column is False.
The displayed values correspond to the custom configuration for the Default ask pass option.
Exit the ansible-navigator command by pressing ESC.
Change the value of the ask_pass setting in the ansible.cfg file to true.
The resulting ansible.cfg file should read as follows:
[defaults]
inventory=inventory
remote_user=devops
ask_pass=trueUse the ansible-navigator config command again and search for the Default ask pass setting.
Type :f ask and then press Enter.
Name Default Source Current
0│Default ask pass False /home/student/config-ansible/a True
1│Default ask vault pass True default False
...output omitted...The Default ask pass setting has a value of True if it is not overridden.
Although this value matches the value configured in your ansible.cfg file, line 0 in your terminal output remains yellow and the value in the Default column is False.
The ansible.cfg file in your current directory overrides the Default ask pass setting, even if the file uses the same value as the default value for the setting.
The displayed values correspond to the custom configuration for the Default ask pass option:
| Field | Value |
|---|---|
False
| |
/home/student/config-ansible/ansible.cfg
| |
True
|
Exit the ansible-navigator command by pressing ESC.