This repository contains configuration files and Ansible playbooks for automating the deployment and maintenance of our software applications.
Most playbooks should be run with the file inventory.yaml
used as an inventory for Ansible. This file contains the most complete and up-to-date list of virtual machines used as hosts for our services.
To simplify usage, we recommend using an Ansible configuration file with some sane defaults.
Create a new ansible.cfg
file in this directory, with the following contents:
[defaults]
# Ansible inventory sources
inventory=inventory.yaml
# Path to SSH private key
private_key_file=~/.ssh/id_unibuc
[inventory]
# Give an error when host pattern doesn't match anything
host_pattern_mismatch=error
# Give an error if inventory file could not be parsed
any_unparsed_is_failed=True
Replace ~/.ssh/id_unibuc
with the pass to your SSH private key.
The commands listed below assume that you have, at the very least, configured the default inventory file path and the SSL private key to be used.
ansible '<host>' -m ansible.builtin.shell -a '<some command>'
ansible-playbook check-for-updates.playbook.yaml --extra-vars "variable_host='<host>'"
ansible-playbook -v update-packages.playbook.yaml --extra-vars "variable_host='<host>'"