Ansible role: package_update v2.0.2

1 minute read

ansible-role-pkg_update

Keeping your software up-to-date is an important task in System Administration. Not only for security reasons but also to roll out bug fixes to your systems.

As always we should try to automate this process as much as possible.

Ansible has a package module to install packages in a generic way. It supports most Un*x platforms (GNU/Linux, BSD, …). But it doesn’t allow you to update all packages.

For this reason, I created an Ansible role: package update.

Package update enables you to update all packages on most Linux distributions and the BSD operating systems. It can also update the running jails on FreeBSD.

Version 2.0.2 is available at

Version 2.0.2:Permalink

Changelog:Permalink

  • Always update the apt cache on Debian based distributions.

Have fun!

Ansible Role: package_updatePermalink

An ansible role to update all packages (multiplatform)

RequirementsPermalink

Supported platformsPermalink

  • Archlinux
  • Debian
  • FreeBSD
  • NetBSD
  • OpenBSD
  • RedHat
  • Suse
  • Kali GNU/Linux

Role VariablesPermalink

The following variables are set by the role.

  • freebsd_running_jails: List with the running FreeBSD jails.
  • package_update: “name space”
    • freebsd: “freebsd config”
      • get_running_jails: no yes (default) set the freebsd_running_jails variable.
      • host: no yes (default) update the host system
      • jails: Array of jails to update, freebsd_running_jails by default.

DependenciesPermalink

None

Example PlaybooksPermalink

UpgradePermalink

---
- name: update packages
  hosts: all
  become: true
  roles:
    - stafwag.package_update

Update only the FreeBSD host systems.Permalink

---
- name: update packages
  hosts: all
  become: true
  roles:
    - role: stafwag.package_update
      vars:
        package_update:
          freebsd:
            get_running_jails: no
            jails: []

Update only the running jails on FreeBSD systems.Permalink

---
- name: update packages
  hosts: all
  become: true
  roles:
    - role: stafwag.package_update
      vars:
        package_update:
          freebsd:
            host: no

Update a jail on a FreeBSD system.Permalink

---
- name: update packages
  hosts: rataplan
  become: true
  roles:
    - role: stafwag.package_update
      vars:
        package_update:
          freebsd:
            host: no
            jails:
              - stafmail

LicensePermalink

MIT/BSD

Author InformationPermalink

Created by Staf Wagemakers, email: staf@wagemakers.be, website: http://www.wagemakers.be

Leave a comment