Pages

Saturday, 23 November 2019

EX294: Configuration files

Just like other classic Unix tools, Ansible uses plain text configuration files to define it's running parameters.

Exam Tips:

$ ansible-config -h
$ ansible-config list

0. Where are the configuration files

Ansible support multiple configuration files.

  • /etc/ansible/ansible.cfg
  • ~/.ansible.cfg
  • ./ansible.cfg
  • $ANSIBLE_CONFIG
The latter overrides the former.

1. What are in a configuration file

The configuration file can contain so many parameters that it's impossible to list everyone here.
Here we just list some most common ones.

  • inventory=/etc/ansible/hosts # define the default inventory
  • host_key_checking=False      # for ssh security
  • remote_tmp                   # managed nodes' tmp dir for ansible

2 Other places to put configuration 

Besides the configuration files mentioned above, there are other places where configuration variables can be put.
  • within a command-line 
  • a playbook
As a result, attention must be paid to the fact that some configuration parameters may be defined in multiple places and the final value will be calculated by priority.

No comments:

Post a Comment