GROG.package

Package

Ansible Galaxy
Build Status
Latest tag
Gitter chat

This is a role for managing software packages on various operating systems.

Currently, it works with apt, yum, dnf, brew, zypper, pacman, and portage.
You can suggest adding your favorite package manager via a pull or feature request!

Note:

  • This role accounts for name differences between package managers but not for different distributions that use the same package manager.
  • Test coverage is limited, so please report any bugs!

Requirements

  • Hosts need to be set up for Ansible (must have Python, etc.)
  • Root access is required, e.g., use become: yes

Role Variables

Variable Description Default value
package_list List of packages (see details!) []
package_list_host Specific packages for a host (see details!) []
package_list_group Specific packages for a group (see details!) []
package_state Default state for packages 'present'
package_update_cache Update the package cache? yes
package_cache_valid_time How long the package cache is valid (in seconds) 3600

Details on package_list

package_list, package_list_host, and package_list_group will be combined when managing the packages. Use these lists to specify packages for particular hosts or groups.

The package list lets you define which packages should be managed. Each item in the list can have the following attributes:

Variable Description Required
name Name of the package Yes
state Package state No
apt Name for apt No
apt_ignore Ignore this package in apt No
apt_install_recommends Install recommended dependencies in apt No
apk Name for apk No
apk_ignore Ignore this package in apk No
yum Name for yum No
yum_ignore Ignore this package in yum No
dnf Name for dnf No
dnf_ignore Ignore this package in dnf No
brew Name for brew No
brew_ignore Ignore this package in brew No
zypper Name for zypper No
zypper_ignore Ignore this package in zypper No
pacman Name for pacman No
pacman_ignore Ignore this package in pacman No
portage Name for portage No
portage_ignore Ignore this package in portage No
opkg Name for opkg No
opkg_ignore Ignore this package in opkg No

By default, package_state and item.name will be used for package management. If item.state or a specific package name (like item.apt) is provided, those will take precedence. To ignore a package for certain managers, set ***_ignore to yes.

Example of package_list
package_list:
  - name: package
  - name: package1
    state: absent
  - name: package2
    apt: package2_apt_name
  - name: package3
    apt_ignore: yes
    yum: package3_yum_name
    pacman: package3_pacman_name
    portage: package3_portage_name

Dependencies

None.

Example Playbook

---
- hosts: servers
  roles:
  - { role: GROG.package,
      become: yes,
        package_list: [
          { name: htop,
            brew: htop-osx },
          { name: tree }
        ]
    }

Contributing

Any help, changes, or ideas are welcome!

Author

By G. Roggemans

License

MIT

Informazioni sul progetto

A role for installing packages on different operating systems.

Installa
ansible-galaxy install GROG.package
Licenza
mit
Download
260k
Proprietario
Open Source Science and Technology