Ansilbe apt handling of dpkg_options

456 views
Skip to first unread message

adam.fr...@gmail.com

unread,
Dec 9, 2016, 11:41:54 AM12/9/16
to Ansible Project
I am attempting to perform the follow in order to only upgrade ubuntu security updates...

    apt: upgrade=yes update_cache=yes dpkg_options='Dir::Etc::SourceList=/etc/apt/security.sources.list'

and I receive the following error message...

 FAILED! => {"changed": false, "failed": true, "msg": "'/usr/bin/aptitude safe-upgrade' failed: E: Sub-process /usr/bin/dpkg returned an error code (2)\nFailed to perform requested operation on package.  Trying to recover:\n", "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nReading extended state information...\nInitializing package states...\nBuilding tag database...\nThe following packages will be upgraded:\n  apport libc-bin libc6 locales multiarch-support python3-apport \n  python3-problem-report snapd \n8 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 0 B/12.8 MB of archives. After unpacking 623 kB will be freed.\nWriting extended state information...\nPreconfiguring packages ...\ndpkg: error: unknown option --Dir::Etc::SourceList=/etc/apt/security.sources.list\r\n\r\nType dpkg

I am trying to replicate this functioning command... 

apt update && apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/security.sources.list

Any advice on the best way to handle this or some better examples on dpkg_options?

Thank you,
Adam

adam.fr...@gmail.com

unread,
Jan 13, 2017, 9:44:19 AM1/13/17
to Ansible Project
Any help on this?  This is still an issue.  It appears the module ignores any other source files I have and just uses sources.list.  Any suggestions?

Kai Stian Olstad

unread,
Jan 13, 2017, 10:28:12 AM1/13/17
to ansible...@googlegroups.com
On 09. des. 2016 17:41, adam.fr...@gmail.com wrote:
> I am attempting to perform the follow in order to only upgrade ubuntu
> security updates...
>
> apt: upgrade=yes update_cache=yes
> dpkg_options='Dir::Etc::SourceList=/etc/apt/security.sources.list'

The dpkg_options is for the "-o Dpkg::Options::=--<something>" where
<something> is what you add to the dpkg_options.


> I am trying to replicate this functioning command...
>
> apt update && apt-get upgrade -o
> Dir::Etc::SourceList=/etc/apt/security.sources.list
>
> Any advice on the best way to handle this or some better examples on
> dpkg_options?

apt module doesn't support Dir::Etc::SourceList so the shell module is
an alternative.

- shell: apt update && apt-get upgrade -o
Dir::Etc::SourceList=/etc/apt/security.sources.list

--
Kai Stian Olstad

adam.fr...@gmail.com

unread,
Jan 16, 2017, 10:40:30 AM1/16/17
to Ansible Project, ansible-pr...@olstad.com
Thank you!  That did it!
Reply all
Reply to author
Forward
0 new messages