# Ansible 1.3.2 user module problem

**URL:** <https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654>\
**Category:** Ansible Project\
**Created:** [October 10, 2013, 1:37pm UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654 "2013-10-10T13:37:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 10, 2013, 1:37pm UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/1 "2013-10-10T13:37:52Z")

</div>

Hi,

I have a playbook that creates users on systems.

A part of this playbook is this:

_- name: User Jurrien_  
_user: name=jurrien uid= comment=“J. Bloemen (Jurrien) ” groups=unixbeheer password={{ jurrien\_password }}_

In version 1.2.3 this works perfect!

In version 1.3.2 I get this error:

_\<prdunix0001.ict.domain.nl\> ESTABLISH CONNECTION FOR USER: jurrien on PORT 22 TO prdunix0001.ict.domain.nl_  
_\<prdunix0001.ict.domain.nl\> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1381412043.2-39888688610240 && chmod a+rx $HOME/.ansible/tmp/ansible-1381412043.2-39888688610240 && echo $HOME/.ansible/tmp/ansible-1381412043.2-39888688610240’_  
_\<prdunix0001.ict.domain.nl\> REMOTE\_MODULE user name=jurrien uid= comment=“J. Bloemen (Jurrien) ” groups=unixbeheer password=$6$VXjAyxtz$rZSz6zsBxSQl9QP3SnbDv9vx/y9sdcvHT9yU0wCsgQ7qcFVMM3eb1AOodzFWTXUflYH0lbpeSq7v2p/LEgzF81_  
_\<prdunix0001.ict.domain.nl\> PUT /tmp/tmpP82ejK TO /home/jurrien/.ansible/tmp/ansible-1381412043.2-39888688610240/user_  
_\<prdunix0001.ict.domain.nl\> EXEC /bin/sh -c ‘/usr/bin/python /home/jurrien/.ansible/tmp/ansible-1381412043.2-39888688610240/user; rm -rf /home/jurrien/.ansible/tmp/ansible-1381412043.2-39888688610240/ \>/dev/null 2\>&1’_  
_failed: [prdunix0001.ict.domain.nl] =\> {“cmd”: [“/usr/sbin/usermod”, “-p”, “encrypyted password”, “jurrien”], “failed”: true, “item”: “”, “rc”: 13}_  
_msg: [Errno 13] Permission denied_

_FATAL: all hosts have already failed – aborting_

Is this a bug or am I doing something wrong?

Kind regards, Jurriën

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 11, 2013, 12:11am UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/2 "2013-10-11T00:11:10Z")

</div>

I’m not sure. Sounds like you got a permission denied error from usermod because it’s trying to do more than it used to be doing.

Perhaps something you can help explore more using the “./hacking/test-module” script that is in the checkout on the remote system.

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 11, 2013, 8:44am UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/3 "2013-10-11T08:44:56Z")

</div>

I would like to help. No problem.

Oke, Do I have to checkout the git repo for that? I’m now using a RPM from the EPEL repo.

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 11, 2013, 9:25am UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/4 "2013-10-11T09:25:26Z")

</div>

In the Git repo version 1.4 exists and I tried it with this version also but the same error. Also the module rhn\_register is not working:

\<euphrates.ict.domain.nl\> ESTABLISH CONNECTION FOR USER: jurrien on PORT 22 TO euphrates.ict.domain.nl  
\<euphrates.ict.domain.nl\> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1381483432.52-169344486506095 && chmod a+rx $HOME/.ansible/tmp/ansible-1381483432.52-169344486506095 && echo $HOME/.ansible/tmp/ansible-1381483432.52-169344486506095’  
\<euphrates.ict.domain.nl\> REMOTE\_MODULE lineinfile dest=/etc/sysconfig/rhn/up2date regexp=“^serverURL=” line=“serverURL=[https://prdrhn0001.ict.domain.nl/XMLRPC](https://prdrhn0001.ict.domain.nl/XMLRPC)”  
\<euphrates.ict.domain.nl\> PUT /tmp/tmp4oDY8a TO /home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/lineinfile  
\<euphrates.ict.domain.nl\> EXEC /bin/sh -c ‘/usr/bin/python /home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/lineinfile; rm -rf /home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/ \>/dev/null 2\>&1’  
failed: [euphrates.ict.domain.nl] =\> {“failed”: true, “item”: “”, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/lineinfile”, line 1260, in ?  
main()  
File “/home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/lineinfile”, line 319, in main  
ins\_aft, ins\_bef, create, backup, backrefs)  
File “/home/jurrien/.ansible/tmp/ansible-1381483432.52-169344486506095/lineinfile”, line 166, in present  
f = open(dest, ‘rb’)  
IOError: [Errno 13] Permission denied: ‘/etc/sysconfig/rhn/up2date’

Now trying the test-module…

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 11, 2013, 9:43am UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/5 "2013-10-11T09:43:19Z")

</div>

It looks like the commands aren’t running with sudo…

[jurrien@prdunix0001 ansible]$ ./hacking/test-module -m library/system/user -a “password= name=jurrien”

- including generated source, if any, saving to: /home/jurrien/.ansible\_module\_generated
- this will offset any line numbers in tracebacks/debuggers!

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 14, 2013, 9:43am UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/6 "2013-10-14T09:43:34Z")

</div>

In version 1.2.2 and 1.2.3 you could forget sudo: yes in the playbooks. In version 1.3 and higher you need to put this in the playbooks if want to use sudo.

Problem solved for me!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 14, 2013, 12:31pm UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/7 "2013-10-14T12:31:44Z")

</div>

What do you mean by “you could forget sudo: yes” ?

Are you saying that ‘–sudo yes’ does not appear to be setting the default for you?

Or do you mean that passing ‘–sudo-user’ doesn’t set the sudo condition to true (this last part is true).

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 14, 2013, 12:41pm UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/8 "2013-10-14T12:41:29Z")

</div>

In the playbooks I created when I was using Ansible 1.2.X I didn’t added the option “sudo: yes” but when running the playbook I added the “-K” option because I am using sudo with password to execute the modules/commands.

After upgrading to version 1.3 or higher I need to add “sudo: yes” to each playbook or I get the permission denied errors.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 14, 2013, 1:18pm UTC](https://forum.ansible.com/t/ansible-1-3-2-user-module-problem/13654/9 "2013-10-14T13:18:27Z")

</div>

Right, that’s intended.

Because you might have some playbooks running sudo and some not.

If you want to be explicit on the command line you can just say “–sudo” and that will default sudo on for everthing, and fits nicely with the “–ask-sudo-pass” (-K)
