# User module change AIX password

**URL:** <https://forum.ansible.com/t/user-module-change-aix-password/16308>\
**Category:** Ansible Project\
**Created:** [September 23, 2014, 4:50pm UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308 "2014-09-23T16:50:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark6](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mark6](https://forum.ansible.com/u/Mark6)\
**Post date:** [September 23, 2014, 4:50pm UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308/1 "2014-09-23T16:50:22Z")

</div>

This process seems to be elusive for AIX. I have tried several hash types and string substitutions. Any help would be much appreciated.

Below is the run of the playbook.

ansible-playbook account.yml -i./hosts -k -K  
SSH password:  
sudo password [defaults to SSH password]:  
Enter new password:  
confirm Enter new password:

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [testhost]

TASK: [Show Hash Value] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [testhost] =\> {  
“msg”: “new\_password $6$rounds=40000$VDQKJU4ZPdhvfwi0$Gk7S48sb7WqIHtJnE/tFvkHmAUc4MOys8pGDLgd8/lJ2s9d9wByGrNYiFVufzCZmBd9N3HArf0UmxAX8ES/i81”  
}

TASK: [Update account on AIX] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [testhost]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
testhost : ok=2 changed=1 unreachable=0 failed=0

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [September 23, 2014, 7:02pm UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308/2 "2014-09-23T19:02:12Z")

</div>

What is the result? The account’s password is not updated even though ansible reported success?

-Toshio

---

<div class="post-metadata">

**Author:** ![Mark6](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mark6](https://forum.ansible.com/u/Mark6)\
**Post date:** [September 23, 2014, 7:26pm UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308/3 "2014-09-23T19:26:15Z")

</div>

I would really appreciate any help. I am baffled on why the task claims to be successful, but the /etc/security/password file is not modified.

---

<div class="post-metadata">

**Author:** ![Mark6](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mark6](https://forum.ansible.com/u/Mark6)\
**Post date:** [September 23, 2014, 10:24pm UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308/4 "2014-09-23T22:24:25Z")

</div>

Looking closer at the Ansible doc for User module is says it depends on usermod. The man page for AIX usermod does not show an option to set the password. So running the user module against an AIX 7.1 machine looks to be not supported. Instead it looks like I should do something with chpasswd instead for an AIX target host.

---

<div class="post-metadata">

**Author:** ![sascha.lucas](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@sascha.lucas](https://forum.ansible.com/u/sascha.lucas)\
**Post date:** [September 26, 2014, 6:08am UTC](https://forum.ansible.com/t/user-module-change-aix-password/16308/5 "2014-09-26T06:08:43Z")

</div>

Hi Mark,

> Looking closer at the Ansible doc for User module is says it depends on usermod. The man page for AIX usermod does not show an option to set the password.

Looking more close, one will see:

class AIX(User):  
...  
def modify\_user\_usermod(self):  
&nbsp;&nbsp;...  
&nbsp;&nbsp;# set password with chpasswd  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...  
&nbsp;&nbsp;cmd =   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.append('echo "'+self.name+':'+self.password+'" |')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.append(self.module.get\_bin\_path('chpasswd', True))

So I can say, that setting a password hash with the user module works on AIX (hash appears in /etc/security/passwd). However, this function is not idempotent, because other parts in the code assumes that SHADOWFILE = '/etc/security/passwd' has columns, like /etc/shadow on linux, to compare if the hash has changed (someone should fill a issue/bug).

What troubles me more, is to create working hashes on the linux control machine (using mkpasswd). The only method working seems smd5.

Thanks, Sascha.

Aufsichtsratsvorsitzender: Herbert Vogel  
Geschäftsführung: Michael Krüger  
Sitz der Gesellschaft: Halle/Saale  
Registergericht: Amtsgericht Stendal | Handelsregister-Nr. HRB 208414  
UST-ID-Nr. DE 158253683

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Empfänger sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail oder des Inhalts dieser Mail sind nicht gestattet. Diese Kommunikation per E-Mail ist nicht gegen den Zugriff durch Dritte geschützt. Die GISA GmbH haftet ausdrücklich nicht für den Inhalt und die Vollständigkeit von E-Mails und den gegebenenfalls daraus entstehenden Schaden. Sollte trotz der bestehenden Viren-Schutzprogramme durch diese E-Mail ein Virus in Ihr System gelangen, so haftet die GISA GmbH - soweit gesetzlich zulässig - nicht für die hieraus entstehenden Schäden.
