/ansible-role-package_installation

Simple role to install packages

GNU General Public License v2.0GPL-2.0

ansible-lint Publish latest release to Ansible Galaxy

package_installation

This is a very simple role that will install a list of packages.

Role Variables

variable default required description
pgi_packages unset true List of packages to install. See below example for the exact definition
pgi_quiet_assert false false Whether to quiet the assert statements

Variable pgi_packages

An extended example of only the pgi_packages variable is illustrated down below:

pgi_packages:
  - name: 'qemu-guest-agent'
    state: 'latest'

  - name: 'openssh-server'
    state: 'present'

  - name: 'vim'

The only required option for a package is the name. The state can be either latest, to install the latest available version (so upgrade if it is already present), or present to ensure that the package exists, which is also the default, if the state has not been defined.

Dependencies

None

Example Playbook

---
- name: 'Install packages'
  hosts: 'all'
  gather_facts: false
  roles:
    - role: 'package_installation'
      vars:
        pgi_packages:
          - name: 'qemu-guest-agent'
            state: 'latest'

          - name: 'openssh-server'
            state: 'present'

          - name: 'vim'
...

License

GPL-2.0-or-later