community.general.apt_repo 模块 – 通过 apt-repo 管理 APT 仓库
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在 playbook 中使用它,请指定:community.general.apt_repo。
概要
- 使用 apt-repo 工具管理 APT 仓库。 
- 有关 apt-repo 的详细信息,请参见 https://www.altlinux.org/Apt-repo 
参数
| 参数 | 注释 | 
|---|---|
| 要添加或删除的仓库名称。 | |
| 指示所需的仓库状态。 选项 
 | |
| 更改仓库后更新软件包数据库。 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:不支持 | 可以在  | |
| 支持:不支持 | 在差异模式下,将返回有关已更改内容(或在  | 
备注
注意
- 此模块适用于基于 ALT 的发行版。 
- 由于 apt-repo 工具的限制,不支持 checkmode。 
示例
- name: Remove all repositories
  community.general.apt_repo:
    repo: all
    state: absent
- name: Add repository `Sisysphus` and remove other repositories
  community.general.apt_repo:
    repo: Sisysphus
    state: present
    remove_others: true
- name: Add local repository `/space/ALT/Sisyphus` and update package cache
  community.general.apt_repo:
    repo: copy:///space/ALT/Sisyphus
    state: present
    update: true
