Skip to content

UniBuc-DITC/ansible-automation

Repository files navigation

Ansible playbooks for automated ops

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.

Configuring Ansible

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.

Common tasks

Running an ad-hoc command on a host or a set of hosts

ansible '<host>' -m ansible.builtin.shell -a '<some command>'

Checking for system package updates

ansible-playbook check-for-updates.playbook.yaml --extra-vars "variable_host='<host>'"

Updating system packages

ansible-playbook -v update-packages.playbook.yaml --extra-vars "variable_host='<host>'"

About

Ansible playbooks for automated operations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published