How to use the options `sourcelist`, `sourceparts`, `List-Cleanup` in Ansible `apt` module?

123 views Asked by At

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?

1

There are 1 answers

0
U880D On

From your currently provided information I understand that you like to set additional other_options similar to dpkg_options when using the apt module – Manages apt-packages.

Since that feature isn't available currently

I don't want to use the shell module