ansible / ansible.builtin / v2.11.12 / module / apt_repository Add and remove APT repositories | "added in version" 0.7 of ansible.builtin" Authors: Alexander Saltanov (@sashka)ansible.builtin.apt_repository (v2.11.12) — module
pip
Install with pip install ansible-core==2.11.12
Add or remove an APT repositories in Ubuntu and Debian.
- 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
mode: description: - The octal mode for newly created files in sources.list.d. - Default is what system uses (probably 0644). type: raw version_added: '1.6' version_added_collection: ansible.builtin repo: description: - A source string for the repository. required: true type: str state: choices: - absent - present default: present description: - A source string state. type: str codename: description: - Override the distribution codename to use for PPA repositories. Should usually only be set when working with a PPA on a non-Ubuntu target (for example, Debian or Mint). type: str version_added: '2.3' version_added_collection: ansible.builtin filename: description: - Sets the name of the source list file in sources.list.d. Defaults to a file name based on the repository source url. The .list extension will be automatically added. type: str version_added: '2.1' version_added_collection: ansible.builtin update_cache: aliases: - update-cache default: 'yes' description: - Run the equivalent of C(apt-get update) when a change occurs. Cache updates are run after making changes. type: bool validate_certs: default: 'yes' description: - If C(no), SSL certificates for the target repo will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool version_added: '1.8' version_added_collection: ansible.builtin install_python_apt: default: true description: - Whether to automatically try to install the Python apt library or not, if it is not already installed. Without this library, the module does not work. - Runs C(apt-get install python-apt) for Python 2, and C(apt-get install python3-apt) for Python 3. - Only works with the system Python 2 or Python 3. If you are using a Python on the remote that is not the system Python, set I(install_python_apt=false) and ensure that the Python apt library for your Python version is installed some other way. type: bool update_cache_retries: default: 5 description: - Amount of retries if the cache update fails. Also see I(update_cache_retry_max_delay). type: int version_added: '2.10' version_added_collection: ansible.builtin update_cache_retry_max_delay: default: 12 description: - Use an exponential backoff delay for each retry (see I(update_cache_retries)) up to this max delay in seconds. type: int version_added: '2.10' version_added_collection: ansible.builtin