ednz_cloud.manage_repositories
管理仓库
该仓库只是一个镜像。开发和测试在私有的 Gitea 服务器上进行。
此角色使您能够管理 基于 Debian 的 分发版上的仓库。可以单独使用,也可以通过其他角色按需调用该角色进行仓库配置。
要求
无。
角色变量
可用的变量如下列出,并附有默认值。如果您需要用于任何 group_vars
或 host_vars
配置,可以在 default/manage_repositories.yml.sample
中找到默认值的示例文件。
manage_repositories_enable_default_repo: true # 默认值为 true
该变量启用或禁用主分发版仓库的配置(当调用此角色为其他角色(比如安装 Docker)配置仓库时非常有用)。
manage_repositories_enable_custom_repo: false # 默认值为 false
该变量启用或禁用自定义仓库的配置。
manage_repositories_main_repo_uri: # 默认值包含以下内容
ubuntu: "http://fr.archive.ubuntu.com/ubuntu"
debian: "http://deb.debian.org/debian"
该变量设置主仓库的镜像网址。您可以选择删除不需要的分发版(例如,如果您只使用 Ubuntu,可以执行 remove manage_repositories_main_repo_uri[debian]
)。
manage_repositories_custom_repo: # 默认情况下,该变量未定义
- name: docker
uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}"
comments: "{{ ansible_distribution|lower }} docker 仓库"
types:
- deb
suites:
- "{{ ansible_distribution_release }}"
components:
- stable
options:
Signed-By: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
- name: ...
该变量包含要安装的自定义仓库列表(1 到 N)。如果 manage_repositories_enable_custom_repo == true
,则必须设置该变量,否则角色可能会失败。options
中的条目是可选的,您可以几乎添加所有标准选项。Signed-By
选项需要一个 URL 来下载 GPG 密钥。如果不需要选项,可以完全删除 options
键。
依赖关系
无。
示例剧本
# 在剧本中调用该角色,使用默认值或 group_vars/host_vars
- hosts: servers
roles:
- ednz_cloud.manage_repositories
# 在剧本中调用该角色并注入变量(例如在另一个角色中)
- hosts: servers
tasks:
- name: "配置 HashiCorp 仓库"
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 仓库"
types:
- deb
suites:
- "{{ ansible_distribution_release }}"
components:
- stable
options:
Signed-By: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
许可证
MIT / BSD
作者信息
该角色由 Bertrand Lanson 于 2023 年创建。
安装
ansible-galaxy install ednz_cloud.manage_repositories
许可证
mit
下载
1.9k
拥有者
Automate all the things.