Get yourself an ansible config file, bruh!
Automate with Ansible: Part 3
Use a playbook to automate all your apt updates and upgrades, bruh.
Ansible Config File
Ansible uses a configuration file called
ansible.cfg to set various settings and options. This file is typically located in the
/etc/ansible directory, but it can also be placed in the current working directory or in the home directory of the user running the playbook.
The configuration file contains two sections,
ssh_connection, each one containing several key-value pairs.
inventory = /path/to/inventory
remote_user = ansible
private_key = /path/to/private/key
# The directory containing the playbooks
playbook_dir = /path/to/playbooks
# The path to the callback plugins
callback_plugins = /path/to/callback_plugins
# The path to the action plugins
action_plugins = /path/to/action_plugins
# The path to the connection plugins
connection_plugins = /path/to/connection_plugins
# The path to the lookup plugins
lookup_plugins = /path/to/lookup_plugins
# The path to the inventory plugins
inventory_plugins = /path/to/inventory_plugins
# The path to the vars plugins
vars_plugins = /path/to/vars_plugins
# The path to the filter plugins
filter_plugins = /path/to/filter_plugins
# Timeout for the connection
timeout = 30
# Remote port to use
remote_port = 22
# Use ansible-config instead of ansible-inventory when invoked
interpreter_python = /usr/bin/python3
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
In this example, you can find additional options and paths that can be configured in the ansible.cfg file.
[defaults]section is where you can set defaults for all other sections in the config file.
inventory: This specifies the path to the inventory file that Ansible uses to know which hosts to connect to.
remote_user: This specifies the user to connect as when using SSH.
private_key: This is the…