Regression in 'package' module?

34 views
Skip to first unread message

nusenu

unread,
Nov 22, 2016, 5:30:35 AM11/22/16
to Ansible Project
Hi,

I recently migrated from OS specific modules to the 'package' module to
reduce the number of tasks [1].

At the time I used ansible 2.0 (and IIRC it worked but I'm not 100% sure).

Now I'm running ansible 2.2 and apparently the package module on OpenBSD
targets does not seem to use the openbsd_pkg module(?) and package
installation fails because it looks for ports to build even though build
is set to false (default) ?:

"failed": true,
"invocation": {
"module_args": {
"build": false,
"name": "['tor']",
"ports_dir": "/usr/ports",
"state": "present"
}
},
"item": [
"tor"
],
"msg": "Can't find [tor]\n"


Doesn't the 'package' module use openbsd_pkg on OpenBSD targets?
(installing the tor package with the openbsd_pkg works fine)

Have there been any major changes in the package module between ansible
2.0 and 2.2?

thanks,
nusenu

https://github.com/nusenu/ansible-relayor/issues/85

[1]
https://github.com/nusenu/ansible-relayor/commit/550d656a2c5ec8f2b588b32d9cf256aab2743bb7



signature.asc

nusenu

unread,
Nov 22, 2016, 6:58:25 AM11/22/16
to Ansible Project
turns out this role commit introduced the problem,
it replaces the static string "tor" with the generic "{{ item }}".


https://github.com/nusenu/ansible-relayor/commit/06eaad05443f5282b4ac74af688a5f6e60e45b83#diff-2444ad0870f91f17ca6c2a5e96b26823


signature.asc

nusenu

unread,
Nov 22, 2016, 7:34:51 AM11/22/16
to ansible...@googlegroups.com
> "failed": true,
> "invocation": {
> "module_args": {
> "build": false,
> "name": "['tor']",
> "ports_dir": "/usr/ports",
> "state": "present"
> }
> },
> "item": [
> "tor"
> ],
> "msg": "Can't find [tor]\n"

I'm wondering why is name set to "['tor']" and not "tor"

even after changing tor_packages from:

tor_packages: tor

to

tor_packages:
- tor

or

tor_packages: ['tor']

signature.asc

Brian Coca

unread,
Nov 22, 2016, 11:39:37 AM11/22/16
to ansible...@googlegroups.com
when an argument is defined as a list, it is always a list, even if you only supply one element.

----------
Brian Coca

nusenu

unread,
Nov 22, 2016, 12:07:21 PM11/22/16
to ansible...@googlegroups.com


Brian Coca:
> when an argument is defined as a list, it is always a list, even if you
> only supply one element.

Yes, that is what I actually expect.

and that is why I do not understand that name is set to the entire list
instead of the first (and only) item of the list if I use it in a
with_items loop:


https://github.com/nusenu/ansible-relayor/blob/master/tasks/main.yml#L43


Or am I misreading the error message?

signature.asc

Brian Coca

unread,
Nov 22, 2016, 12:50:57 PM11/22/16
to ansible...@googlegroups.com
can you run with -vvv and show that output? also can you check the value of asnible_pkg_mgr?


----------
Brian Coca

Brian Coca

unread,
Nov 22, 2016, 3:06:13 PM11/22/16
to ansible...@googlegroups.com
The task executes once per item, I'm guessing it failed on the first one.

----------
Brian Coca

nusenu

unread,
Nov 23, 2016, 7:13:43 AM11/23/16
to ansible...@googlegroups.com
Brian Coca:
> The task executes once per item, I'm guessing it failed on the first one.

After further tests I've come to the conclusion that this is actually a bug.

I filed the bug report here:
https://github.com/ansible/ansible-modules-core/issues/5708


Looking forward to your comments and a fix.

signature.asc
Reply all
Reply to author
Forward
0 new messages