ansible.builtin.apt_repository – Add and remove APT repositories¶
Note
This module is part of ansible-base
and included in all Ansible
installations. In most cases, you can use the short module name
apt_repository even without specifying the collections:
keyword.
Despite that, we recommend you use the FQCN for easy linking to the module
documentation and to avoid conflicting with other collections that may have
the same module name.
New in version 0.7: of ansible.builtin
Requirements¶
The below requirements are needed on the host that executes this module.
python-apt (python 2)
python3-apt (python 3)
Parameters¶
Notes¶
Note
This module works on Debian, Ubuntu and their derivatives.
This module supports Debian Squeeze (version 6) as well as its successors.
Supports
check_mode
.
Examples¶
- name: Add specified repository into sources list
ansible.builtin.apt_repository:
repo: deb http://archive.canonical.com/ubuntu hardy partner
state: present
- name: Add specified repository into sources list using specified filename
ansible.builtin.apt_repository:
repo: deb http://dl.google.com/linux/chrome/deb/ stable main
state: present
filename: google-chrome
- name: Add source repository into sources list
ansible.builtin.apt_repository:
repo: deb-src http://archive.canonical.com/ubuntu hardy partner
state: present
- name: Remove specified repository from sources list
ansible.builtin.apt_repository:
repo: deb http://archive.canonical.com/ubuntu hardy partner
state: absent
- name: Add nginx stable repository from PPA and install its signing key on Ubuntu target
ansible.builtin.apt_repository:
repo: ppa:nginx/stable
- name: Add nginx stable repository from PPA and install its signing key on Debian target
ansible.builtin.apt_repository:
repo: 'ppa:nginx/stable'
codename: trusty
Authors¶
Alexander Saltanov (@sashka)