0

I want to run the following apt command via the 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
Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Shubham Saroj
  • 290
  • 2
  • 12
  • 1
    `I don't want to use the shell module`. I'm affraid you won't have any other choice as there are no ways listed in the [module documentation](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html) to set these kind of options. – Zeitounator Jan 30 '23 at 17:18
  • Thanks @Zeitounator. Will go with shell if I don't find until tomorrow. – Shubham Saroj Jan 30 '23 at 17:35

0 Answers0