Configuring Ansible

Ansible has its default configuration file in /etc/ansible/ansible.cfg. There are many options grouped in blocks. These are the blocks and the most-used options:

  • [defaults]: The default configuration options for the execution of Ansible:
    • inventory: Defines the location of the inventory file, which by default is /etc/ansible/hosts
    • sudo_user: The user with whom sudo will log in; by default it is root
    • forks: The number of Ansible parallel processes; by default it is 5
    • timeout: The timeout for an SSH connection; the default is 10 seconds
    • log_path: The location of the log file; by default /var/log/ansible.log
    • nocows: If its value is 0 and we have cowsay installed, we will see one of the animals reporting the playbooks; by default it is 1
  • [privilege_escalation]: The options regarding privilege escalation
    • become: If True, the user that we connect with will try to scale privileges; by default False
    • become_method: The method to use to scale privileges; by default sudo
    • become_user: The user it will be scaled to; by default root
  • [ssh_connection]: Options related to the SSH connection
    • ssh_args: The options that Ansible will use in executing SSH
    • control_path: Ansible makes use of multiplex to reduce the number of connections, this option defines the socket file to create
    • scp_if_ssh: The mechanism we use to transfer files; by default it will try to use sftp, and if it fails, it will try with scp
  • [colors]: Define the colors of the different Ansible messages
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset