community.general.apt_repo module – Manage APT repositories via apt-repo

Note

This module is part of the community.general collection (version 9.0.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.apt_repo.

Synopsis

Parameters

Parameter

Comments

remove_others

boolean

Remove other then added repositories

Used if state=present

Choices:

  • false ← (default)

  • true

repo

string / required

Name of the repository to add or remove.

state

string

Indicates the desired repository state.

Choices:

  • "absent"

  • "present" ← (default)

update

boolean

Update the package database after changing repositories.

Choices:

  • false ← (default)

  • true

Attributes

Attribute

Support

Description

check_mode

Support: none

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • This module works on ALT based distros.

  • Does NOT support checkmode, due to a limitation in apt-repo tool.

Examples

- name: Remove all repositories
  community.general.apt_repo:
    repo: all
    state: absent

- name: Add repository `Sisysphus` and remove other repositories
  community.general.apt_repo:
    repo: Sisysphus
    state: present
    remove_others: true

- name: Add local repository `/space/ALT/Sisyphus` and update package cache
  community.general.apt_repo:
    repo: copy:///space/ALT/Sisyphus
    state: present
    update: true

Authors

  • Mikhail Gordeev (@obirvalger)