我想通过Ansible模块运行以下apt
命令。
apt-get update -o Dir::Etc::sourcelist="sources.list.d/mypackages.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
字符串
我不想使用shell模块来实现这个目的,如下所示。
- name: update apt package manager with parameters
shell: 'apt-get update -o Dir::Etc::sourcelist="sources.list.d/mypackages.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"'
型
稍后在执行更新后,我正在安装这些软件包,
- name: install plugin and core package
apt:
pkg:
- dump_plugin
- core
state: present
allow_unauthenticated: yes
update_cache: yes
型
如何在Ansible apt
模块中使用sourcelist
,sourceparts
,List-Cleanup
选项?
1条答案
按热度按时间gorkyyrv1#
从您目前提供的信息中,我了解到您喜欢在使用
apt
module – Manages apt-packages时设置类似于dpkg_options
的附加other_options
。由于该功能目前不可用
shell
module – Execute shell commands on targets,就像已经在注解中一样,shell
模块 *apt.py
并在自己的分支中实现使用other_options
的功能,类似于可用的dpkg_options
DPKG_OPTIONS ...
个def expand_dpkg_options ...
def install ...
个if build_dep:
直到该功能可满足您的需求为止。