Skip to content

ednz-cloud/manage_repositories

Repository files navigation

📃 Role overview

manage_repositories

Description: Repository management for debian-based distros.

Field Value
Readme update 14/06/2025

Defaults

These are static variables with lower priority

File: defaults/main.yml

Var Type Value Required Title
manage_repositories_enable_default_repo bool True false Enable or disable the default repository management.
manage_repositories_main_repo_uri dict {'ubuntu': 'http://fr.archive.ubuntu.com/ubuntu', 'debian': 'http://deb.debian.org/debian'} true The main repository URI for the distribution.
manage_repositories_enable_custom_repo bool False false Enable or disable the custom repository management.
manage_repositories_custom_repo list [] false Custom repositories to be managed.
🖇️ Full descriptions for vars in defaults/main.yml
manage_repositories_enable_default_repo: Enable or disable the default repository management.
If set to true, the default repositories for the distribution will be managed.

manage_repositories_main_repo_uri: The main repository URI for the distribution.
This is used to set the main repository for the distribution.

manage_repositories_enable_custom_repo: Enable or disable the custom repository management.

manage_repositories_custom_repo: A list of custom repositories to be managed.
Each repository should be a dictionary with the following keys:
- name: The name of the repository.
- uri: The URI of the repository.
- comments: A comment for the repository.
- types: The types of the repository (e.g., deb, rpm).
- suites: The suites of the repository (e.g., stable, testing).
- components: The components of the repository (e.g., main, universe).
- signed_by: The URI of the GPG key for the repository. (optional).
See the deb822 module documentation for more details.
Example:
- name: docker
uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}"
comments: "{{ ansible_distribution|lower }} docker repository"
types:
- deb
suites:
- "{{ ansible_distribution_release }}"
components:
- stable
signed_by: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"


Vars

These are variables with higher priority

File: vars/debian.yml

Var Type Value Required Title
manage_repositories_default_repo list [{'name': 'debian', 'uri': '{{ manage_repositories_main_repo_uri[ansible_distribution¦lower] }}', 'comments': 'debian main repository', 'types': ['deb'], 'suites': ['{{ ansible_distribution_release }}', '{{ ansible_distribution_release }}-updates', '{{ ansible_distribution_release }}-backports'], 'components': ['main']}, {'name': 'debian-security', 'uri': '{{ manage_repositories_main_repo_uri[ansible_distribution¦lower] }}-security', 'comments': 'debian main repository', 'types': ['deb'], 'suites': ['{{ ansible_distribution_release }}-security'], 'components': ['main']}] true Default repository configuration for Debian distributions.

File: vars/main.yml

Var Type Value Required Title
manage_repositories_sources_list_location str /etc/apt/sources.list true Location of the sources list file.
manage_repositories_repo_location str /etc/apt/sources.list.d true Location of the repository files.
manage_repositories_signing_keys_location str /usr/share/keyrings true Location of the signing keys.
manage_repositories_sources_list_message str # See /etc/apt/sources.list.d/{{ ansible_distribution¦lower }}.sources\n true Comment for the sources list file.
manage_repositories_required_packages list ['python3-debian'] true Required packages for managing repositories.

File: vars/ubuntu.yml

Var Type Value Required Title
manage_repositories_default_repo list [{'name': 'ubuntu', 'uri': '{{ manage_repositories_main_repo_uri[ansible_distribution¦lower] }}', 'comments': 'ubuntu main repository', 'types': ['deb'], 'suites': ['{{ ansible_distribution_release }}', '{{ ansible_distribution_release }}-security', '{{ ansible_distribution_release }}-updates', '{{ ansible_distribution_release }}-backports'], 'components': ['main', 'restricted', 'universe', 'multiverse']}] true Default repository configuration for Ubuntu distributions.
🖇️ Full Descriptions for vars in vars/debian.yml
manage_repositories_default_repo: This variable defines the default repositories for Debian distributions.

🖇️ Full Descriptions for vars in vars/main.yml
manage_repositories_sources_list_location: This variable defines the location of the sources list file for the package manager.
manage_repositories_repo_location: This variable defines the location of the repository files for the package manager.
manage_repositories_signing_keys_location: This variable defines the location of the signing keys for the package manager.
manage_repositories_sources_list_message: This variable defines the comment for the sources list file (because it is not used).
manage_repositories_required_packages: This variable defines the packages required for managing repositories.

🖇️ Full Descriptions for vars in vars/ubuntu.yml
manage_repositories_default_repo: This variable defines the default repositories for Ubuntu distributions.

Tasks

File: tasks/custom_repositories.yml

Name Module Has Conditions
APT Repo ¦ Configure custom repositories ansible.builtin.deb822_repository False
APT Repo ¦ Set cache-update variable ansible.builtin.set_fact True

File: tasks/main.yml

Name Module Has Conditions
APT Repo ¦ Set cache-update variable ansible.builtin.set_fact False
APT Repo ¦ Load variables ansible.builtin.include_vars False
APT Repo ¦ Import prerequisites.yml ansible.builtin.include_tasks False
APT Repo ¦ Import main repositories for {{ ansible_distribution¦lower }} ansible.builtin.include_tasks True
APT Repo ¦ Import custom_repositories.yml ansible.builtin.include_tasks True
APT Repo ¦ Update apt caches ansible.builtin.apt True

File: tasks/main_repositories.yml

Name Module Has Conditions
APT Repo ¦ Emtpy /etc/apt/sources.list block False
APT Repo ¦ Read the current content of source.list ansible.builtin.slurp False
APT Repo ¦ Convert sources.list current content to string ansible.builtin.set_fact False
APT Repo ¦ Define sources.list new content ansible.builtin.set_fact False
APT Repo ¦ Create file /etc/apt/sources.list ansible.builtin.file True
APT Repo ¦ Replace content of /etc/apt/sources.list ansible.builtin.replace True
APT Repo ¦ Configure main repositories into sources.list.d for {{ ansible_distribution¦lower }} ansible.builtin.deb822_repository False
APT Repo ¦ Set cache-update variable ansible.builtin.set_fact True

File: tasks/prerequisites.yml

Name Module Has Conditions
APT Repo ¦ Update repositories cache ansible.builtin.apt False
APT Repo ¦ Install required packages ansible.builtin.apt False

Author Information

Bertrand Lanson

License

license (BSD, MIT)

Minimum Ansible Version

2.10

Platforms

  • Ubuntu: ['focal', 'jammy', 'noble']
  • Debian: ['bullseye', 'bookworm']

Dependencies

No dependencies specified.

About

Ansible role to manage APT repositories debian-based systems. Mirror from https://git.ednz.fr/ansible-roles/manage_repositories.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published