W3cubDocs

/Ansible

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

Note

This plugin is part of the community.general collection (version 3.8.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 Choices/Defaults Comments
remove_others
boolean
    Choices:
  • no
  • yes
Remove other then added repositories
Used if state=present
repo
string / required
Name of the repository to add or remove.
state
string
    Choices:
  • absent
  • present
Indicates the desired repository state.
update
boolean
    Choices:
  • no
  • yes
Update the package database after changing repositories.

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: yes

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

Authors

  • Mikhail Gordeev (@obirvalger)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/apt_repo_module.html