Skip to content

kernt/ansible-role-manage-upgrades

Repository files navigation

Role Name

Manage Upgrades on small company step by step.

Requirements

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

To make a secure upgrade check /var/run/reboot-required on Debian like Os or /usr/bin/needs-restarting on RedHat like OS.

Role Variables

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
  any_errors_fatal: true # stop if anything is wrong
  serial: 1              # one server at a time
  roles:
     - { role: ansible-role-manage-upgrades }

Do tests

You can tests on localhost in /tests.

ansible-playbook -i inventory test.yml

also is a good solution with ansible-pull, too.

Do Upgrades

Upgrade all the Ubuntu servers.

ansible ubuntu -m apt -a "upgrade=yes update_cache=yes" -b

Upgrade all the Debian servers.

ansible debian -m apt -a "upgrade=yes update_cache=yes" -b

Upgrade all the CentOS servers.

ansible centos -m yum -a "name=* state=latest" -b

Upgrade all the Fedora servers.

ansible fedora -m dnf -a "name=* state=latest" -b

Reboot all servers

ansible all -a "reboot" -s

monitor the progress with wait_for and connection: local

Sources

License

BSD

Author Information

Tobias Kern linux system administrator