Ansible role to manage APT repositories debian-based systems. https://ednz.fr
Go to file
Bertrand Lanson 57039dd3a6
All checks were successful
test / Linting (push) Successful in 10s
test / Molecule tests (default, debian12) (push) Successful in 44s
test / Molecule tests (default, ubuntu2004) (push) Successful in 47s
test / Molecule tests (with_custom_repo, debian11) (push) Successful in 1m3s
test / Molecule tests (with_custom_repo, ubuntu2004) (push) Successful in 57s
test / Molecule tests (with_custom_repo, debian12) (push) Successful in 1m3s
test / Molecule tests (default, debian11) (push) Successful in 42s
test / Molecule tests (with_custom_repo, ubuntu2204) (push) Successful in 1m2s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m11s
feat(core): change namespace
2024-02-05 22:19:46 +01:00
.gitea/workflows moved testing to ansible, added debian 12 support and gitea actions 2023-07-01 21:01:53 +02:00
.github/workflows feat(core): change namespace 2024-02-05 22:19:46 +01:00
defaults feat: change default sample file to provide a better example of custom variables 2023-12-01 18:52:51 +01:00
handlers feat: remove become from role, fix #6 2023-12-03 17:56:58 +01:00
meta feat(core): change namespace 2024-02-05 22:19:46 +01:00
molecule feat(core): change namespace 2024-02-05 22:19:46 +01:00
tasks feat(core): change namespace 2024-02-05 22:19:46 +01:00
templates fixed custom repositories, fixed tests 2023-09-13 21:54:24 +02:00
vars fixed custom repositories, fixed tests 2023-09-13 21:54:24 +02:00
.ansible-lint repository migration 2023-03-09 09:29:28 +01:00
.gitignore ignore .vscode 2023-05-21 20:18:14 +02:00
.yamllint repository migration 2023-03-09 09:29:28 +01:00
LICENSE moved testing to ansible, added debian 12 support and gitea actions 2023-07-01 21:01:53 +02:00
README.md feat(core): change namespace 2024-02-05 22:19:46 +01:00

manage_repositories

This repository is only a mirror. Development and testing is done on a private gitea server.

This role enables you to manage repositories on debian-based distributions. It can be used on its own , or be called by other roles the configure repositories on demand.

Requirements

None.

Role Variables

Available variables are listed below, along with default values. A sample file for the default values is available in default/manage_repositories.yml.sample in case you need it for any group_vars or host_vars configuration.

manage_repositories_enable_default_repo: true # by default, set to true

This variable enable or disable the configuration of the main distribution repositories (useful when calling this role to configure repo for another role like installing docker).

manage_repositories_enable_custom_repo: false # by default, set to false

This variable enable of disable the configuration of custom repositories

manage_repositories_main_repo_uri: # by default, this variable has the following values
  ubuntu: "http://fr.archive.ubuntu.com/ubuntu"
  debian: "http://deb.debian.org/debian"

This variable sets the mirror URLs for the main repositories. You can optionally remove the distribution you don't want (ex. remove manage_repositories_main_repo_uri[debian] if you're only using ubuntu).

manage_repositories_custom_repo: # by default, this variable is not defined
  - 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 contains a list (1 to N) of custom repositories to install. IT HAS TO BE SET if manage_repositories_enable_custom_repo == true, or else the role might fail. The options entries are optional, and you can add pretty much all standard options. The Signed-By option expects a URL to download the gpg key. If no options are needed, the options key can be removed completely.

Dependencies

None.

Example Playbook

# calling the role inside a playbook with either the default or group_vars/host_vars
- hosts: servers
  roles:
    - ednz_cloud.manage_repositories
# calling the role inside a playbook and injecting variables (in another role for example)
- 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.