You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A set of Ansible roles for CentOS and Debian hosts that provides users with the option to enable and/or remove automatic updates for packages installed.
Deploy - centos_automatic_updates.yaml and debian_automatic_updates.yaml playbooks will install packages that enable automatic updates. Custom configuration files to set automatic updates will then be copied to the remote hosts. If there are any existing configuration files, a task will fetch the files and store them in a backups directory under the files directory.
For reference, below is a demonstration of how the directory structure of backups will look like after a number of debian_automatic_updates.yaml and centos_automatic_updates.yaml playbook runs at different time intervals.
In this use case, the ansible_sudo_password variable, which is used as the privilege escalation password, is stored in a vault.
Once the secret has been created and added to the playbook, in order for a user be able to become sudo to run the playbook, they will need to decrypt the vault to access the variable.
This can be achieved by passing one of the following flags listed below when executing the the playbook;
--ask-vault-pass
--vault-password-file
Below is a demonstration of how the encrypted variable is defined in the playbooks;
---
# playbook for the debian_automatic_updates role.
- hosts: debian_hosts# vars_files:# - become-secretbecome: trueroles:
- debian_automatic_updates
# clone the repository
$ git clone git@github.com:hubvu/automatic-updates-ansible.git
# navigate into the directory
$ cd automatic-updates-ansible/
# run the master playbook `site.yaml` with verbosity# for non Ansible Vault users
$ ansible-playbook site.yaml \
--inventory-file=hosts \
--ask-become-pass \
--verbose
# run the master playbook `site.yaml` with verbosity# for Ansible Vault users
$ ansible-playbook site_remove.yaml \
--inventory-file=hosts \
--ask-vault-pass \
--verbose
# review the `backups` directory for the configuration files of each host
$ ls /roles/<role_name>/files/backups/<inventory_hostname>/<date_time>-<distribution_name>-<distribution_version>/
Contributing
Contribution guidelines for this project can be found in the Contributing document.
A set of Ansible roles for CentOS and Debian hosts that provides users with the option to enable and/or remove automatic updates for packages installed.