constrict0r.aptitude

Aptitude

This is an Ansible role that acts as a tool for managing packages using apt, which is a package manager for Debian-based systems.

Pipeline Travis Read the Docs

Documentation and Code Repositories

Contents

Description

This Ansible role is designed to manage packages with apt. It can perform several tasks:

  • Check if required packages are installed.
  • Ensure the current user has administrative privileges.
  • Update the apt package list.
  • If the packages_purge variable is set, remove the specified packages.
  • If the configuration variable is set, remove the packages listed in it.
  • If the packages variable is set, install the specified packages.

Usage

To install and run:

ansible-galaxy install constrict0r.aptitude
ansible localhost -m include_role -a name=constrict0r.aptitude -K

To send variables:

ansible localhost -m include_role -a name=constrict0r.aptitude -K -e "{packages: [gedit, rolldice]}"

To include the role in a playbook:

- hosts: servers
  roles:
    - {role: constrict0r.aptitude}

To set the role as a dependency for another role:

dependencies:
  - role: constrict0r.aptitude
    packages: [gedit, rolldice]

To use the role directly in tasks:

- name: Execute role task.
  import_role:
    name: constrict0r.aptitude
  vars:
    packages: [gedit, rolldice]

For running tests:

cd aptitude
chmod +x testme.sh
./testme.sh

Note: You may need to use sudo for some tests.

Variables

The role supports several variables:

packages

A list of packages to install via apt, which can be passed in when invoking the role:

ansible localhost -m include_role -a name=constrict0r.aptitude -K -e "{packages: [gedit, rolldice]}"

packages_purge

A list of packages to remove using apt. This can be set in a similar manner as the packages variable.

configuration

A path or URL to a .yml file containing additional settings for the role.

YAML

When passing configuration files, use the .yml or .yaml extension. Start each file with:

---

Add any required variables below it:

---
packages:
  - [gedit, rolldice]

If you wish the role to load items from files or URLs, set the expand variable to true.

Attributes

You can customize how the role handles data at the item level:

item_expand

A Boolean that determines if the item is treated as a file path/URL or as plain text.

item_path

An absolute file path or URL to a .yml file.

Requirements

  • Ansible >= 2.8
  • Jinja2
  • Pip
  • Python
  • PyYAML
  • Requests

For tests, you also need:

  • Docker
  • Molecule
  • Setuptools

Compatibility

This role works with:

  • Debian Buster
  • Debian Raspbian
  • Debian Stretch
  • Ubuntu Xenial

License

This project is licensed under the MIT license. See the LICENSE file for more details.

UML

Deployment

Deployment Structure

Main

Data Flow

Author

Created by the Travelling Vaudeville Villain.

Enjoy! Enjoy

Informazioni sul progetto

Wrapper for apt to install Debian packages.

Installa
ansible-galaxy install constrict0r.aptitude
Licenza
mit
Download
2.2k
Proprietario
The Traveling Vaudeville Villain Gitlab: gitlab.com/constrict0r - Blog: geekl0g.wordpress.com - Twitter: twitter.com/constrict0r - Functional Café: is.gd/YDqy