ednz_cloud.manage_repositories

Manage Repositories

This document explains how to manage repositories on debian-based systems. This role can work alone or be used by others to set up repositories as needed.

Requirements

No specific requirements.

Role Variables

Here are the available variables along with their default values. You can find a sample file for these values in default/manage_repositories.yml.sample for your group_vars or host_vars setup.

manage_repositories_enable_default_repo: true # Enabled by default

This variable controls whether to set up the main distribution repositories. It's helpful when using this role for another role, like installing Docker.

manage_repositories_enable_custom_repo: false # Disabled by default

This variable controls whether to set up custom repositories.

manage_repositories_main_repo_uri: # Default values are
  ubuntu: "http://fr.archive.ubuntu.com/ubuntu"
  debian: "http://deb.debian.org/debian"

This variable sets the URLs for the main repositories. You can remove any distribution you don't need (e.g., remove manage_repositories_main_repo_uri[debian] if you're only using Ubuntu).

manage_repositories_custom_repo: # Not defined by default
  - 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
    options:
      Signed-By: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
  - name: ...

This variable lists custom repositories you want to install. You must set this if manage_repositories_enable_custom_repo is true, or the role may fail. The options are optional, and you can add standard options. The Signed-By option needs a URL for the GPG key. If not needed, you can remove the options section entirely.

Dependencies

No dependencies.

Example Playbook

Here’s how you can call the role in a playbook:

# Using the role in a playbook with default or group_vars/host_vars
- hosts: servers
  roles:
    - ednz_cloud.manage_repositories
# Using the role with specific variables (e.g., in another role)
- hosts: servers
  tasks:
    - name: "Configure HashiCorp repository"
      ansible.builtin.include_role:
        name: ednz_cloud.manage_repositories
      vars:
        manage_repositories_enable_default_repo: false
        manage_repositories_enable_custom_repo: true
        manage_repositories_custom_repo:
          - 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
            options:
              Signed-By: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"

License

MIT / BSD

Author Information

This role was created by Bertrand Lanson in 2023.

Informazioni sul progetto

Repository management for debian-based distros.

Installa
ansible-galaxy install ednz_cloud.manage_repositories
Licenza
mit
Download
1.9k
Proprietario
Automate all the things.