# Regression in 'package' module?

**URL:** <https://forum.ansible.com/t/regression-in-package-module/23073>\
**Category:** Ansible Project\
**Created:** [November 22, 2016, 10:30am UTC](https://forum.ansible.com/t/regression-in-package-module/23073 "2016-11-22T10:30:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [November 22, 2016, 10:30am UTC](https://forum.ansible.com/t/regression-in-package-module/23073/1 "2016-11-22T10:30:00Z")

</div>

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) ?:

&nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"invocation": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"module\_args": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"build": false,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"name": "['tor']",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ports\_dir": "/usr/ports",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"state": "present"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;"item": [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"tor"  
&nbsp;&nbsp;&nbsp;&nbsp;],  
&nbsp;&nbsp;&nbsp;&nbsp;"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](https://github.com/nusenu/ansible-relayor/issues/85)

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

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [November 22, 2016, 11:57am UTC](https://forum.ansible.com/t/regression-in-package-module/23073/2 "2016-11-22T11:57:00Z")

</div>

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](https://github.com/nusenu/ansible-relayor/commit/06eaad05443f5282b4ac74af688a5f6e60e45b83#diff-2444ad0870f91f17ca6c2a5e96b26823)

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [November 22, 2016, 12:34pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/3 "2016-11-22T12:34:00Z")

</div>

> &nbsp;&nbsp;&nbsp;&nbsp;"failed": true,  
> &nbsp;&nbsp;&nbsp;&nbsp;"invocation": {  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"module\_args": {  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"build": false,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"name": "['tor']",  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ports\_dir": "/usr/ports",  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"state": "present"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> &nbsp;&nbsp;&nbsp;&nbsp;},  
> &nbsp;&nbsp;&nbsp;&nbsp;"item": [  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"tor"  
> &nbsp;&nbsp;&nbsp;&nbsp;],  
> &nbsp;&nbsp;&nbsp;&nbsp;"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:  
&nbsp;&nbsp;- tor

or

tor\_packages: ['tor']

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 22, 2016, 4:39pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/4 "2016-11-22T16:39:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [November 22, 2016, 5:06pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/5 "2016-11-22T17:06:00Z")

</div>

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](https://github.com/nusenu/ansible-relayor/blob/master/tasks/main.yml#L43)

Or am I misreading the error message?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 22, 2016, 5:50pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/6 "2016-11-22T17:50:52Z")

</div>

can you run with -vvv and show that output? also can you check the value of asnible\_pkg\_mgr?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 22, 2016, 8:06pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/7 "2016-11-22T20:06:06Z")

</div>

The task executes once per item, I’m guessing it failed on the first one.

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [November 23, 2016, 12:13pm UTC](https://forum.ansible.com/t/regression-in-package-module/23073/8 "2016-11-23T12:13:00Z")

</div>

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](https://github.com/ansible/ansible-modules-core/issues/5708)

Looking forward to your comments and a fix.
