I want to run the following apt command via an Ansible module.
apt-get update -o Dir::Etc::sourcelist="sources.list.d/mypackages.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
I don't want to use the shell module for this purpose as follows.
- 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"'
Later after executing the update, I am installing these packages,
- name: install plugin and core package
apt:
pkg:
- dump_plugin
- core
state: present
allow_unauthenticated: yes
update_cache: yes
How to use the options sourcelist, sourceparts, List-Cleanup in Ansible apt module?
From your currently provided information I understand that you like to set additional
other_optionssimilar todpkg_optionswhen using theaptmodule – Manages apt-packages.Since that feature isn't available currently
shellmodule – Execute shell commands on targets and as already within the comments,or tweak the source code of
apt.pyand implement in an own fork the capability to useother_optionssimilar to the availabledpkg_optionsDPKG_OPTIONS ...def expand_dpkg_options ...def install ...if build_dep:up to the point were the feature is available for your needs.