Getting started

Default configuration

Role tries to detect the original APT repositories configured on the system and use them in the generated /etc/apt/sources.list configuration file. They will be placed before the default repositories, with assumption that the original repositories pointed to the closest mirror.

The non-free repositories will be enabled automatically on hardware-based hosts in case any non-free firmware is required. Otherwise, only the main and universe (on Ubuntu) repositories are enabled; you can control this using the apt__nonfree variable.

Example inventory

debops.apt is included by default in the common.yml DebOps playbook; you don't need to do anything to have it executed.

If you don’t want to let debops.apt manage APT, you can do this with the following setting in your inventory:

apt__enabled: False

Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.apt role:

---

- name: Manage Advanced Package Manager
  hosts: [ 'debops_all_hosts', 'debops_service_apt' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: debops.apt_preferences
      tags: [ 'role::apt_preferences' ]
      apt_preferences__dependent_list:
        - '{{ apt__apt_preferences__dependent_list }}'

    - role: debops.apt
      tags: [ 'role::apt' ]

Ansible tags

You can use Ansible --tags or --skip-tags parameters to limit what tasks are performed during Ansible run. This can be used after a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:

role::apt
Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.