Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

user momodule shows changed for user after reboot #2943

Closed
rndmh3ro opened this issue Feb 2, 2016 · 8 comments
Closed

user momodule shows changed for user after reboot #2943

rndmh3ro opened this issue Feb 2, 2016 · 8 comments

Comments

@rndmh3ro
Copy link

rndmh3ro commented Feb 2, 2016

Issue Type:

Bug Report

Ansible Version:

2.0.0.2

Environment:

root@vagrant:/home/vagrant# uname -a
Linux vagrant 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@vagrant:/home/vagrant# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

Summary:

When I alter the user with a playbook, the run shows 'changed'. A subsequent run does not show "changed" so idempotency works here.
However after restarting the server and running the playbook again, it shows again as changed.

Steps To Reproduce:

There's a user named "irc" by default on Ubuntu 14.04.
When I alter the user with the following playbook, the run shows 'changed'. A subsequent run does not show "changed" so idempotency works here.
However after restarting the server and running the playbook again, it shows again as changed. But I cannot see any changed in /etc/passwd or /etc/shadow and the user isn't even changed with the task.

- hosts: localhost
  tasks:
    - name: test
      user: name='irc'

Here's the output of the playbook:

Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon Jan 25 19:59:24 2016 from 127.0.0.1
vagrant@vagrant:~$ ansible-playbook --sudo -i hosts  default.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
1 plays in default.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751994.23-142922896848096 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751994.23-142922896848096 )" )'
<127.0.0.1> PUT /tmp/tmpopyDE_ TO /home/vagrant/.ansible/tmp/ansible-tmp-1453751994.23-142922896848096/setup
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-lmpcvnjvveqajnfbptwgmmoxcksxvmyc; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453751994.23-142922896848096/setup; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453751994.23-142922896848096/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [127.0.0.1]

TASK [test] ********************************************************************
task path: /home/vagrant/default.yml:3
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751994.86-84090426534284 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751994.86-84090426534284 )" )'
<127.0.0.1> PUT /tmp/tmp7N6epS TO /home/vagrant/.ansible/tmp/ansible-tmp-1453751994.86-84090426534284/user
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-okpjvfdbdroxtqwhzdvrduetormgqnte; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453751994.86-84090426534284/user; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453751994.86-84090426534284/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
changed: [127.0.0.1] => {"append": false, "changed": true, "comment": "ircd", "group": 39, "home": "/var/run/ircd", "invocation": {"module_args": {"append": false, "comment": null, "createhome": true, "expires": null, "force": false, "generate_ssh_key": null, "group": null, "groups": null, "home": null, "login_class": null, "move_home": false, "name": "irc", "non_unique": false, "password": null, "remove": false, "shell": null, "skeleton": null, "ssh_key_bits": "2048", "ssh_key_comment": "ansible-generated on vagrant", "ssh_key_file": null, "ssh_key_passphrase": null, "ssh_key_type": "rsa", "state": "present", "system": false, "uid": null, "update_password": "always"}, "module_name": "user"}, "move_home": false, "name": "irc", "shell": "/usr/sbin/nologin", "state": "present", "uid": 39}

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

vagrant@vagrant:~$ ansible-playbook --sudo -i hosts  default.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
1 plays in default.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751997.13-81608628853587 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751997.13-81608628853587 )" )'
<127.0.0.1> PUT /tmp/tmpSZ6nQL TO /home/vagrant/.ansible/tmp/ansible-tmp-1453751997.13-81608628853587/setup
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-rfmughrvyutwbtodbhgxnzoxandscylx; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453751997.13-81608628853587/setup; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453751997.13-81608628853587/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [127.0.0.1]

TASK [test] ********************************************************************
task path: /home/vagrant/default.yml:3
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751997.42-28141592809195 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453751997.42-28141592809195 )" )'
<127.0.0.1> PUT /tmp/tmpW0qBit TO /home/vagrant/.ansible/tmp/ansible-tmp-1453751997.42-28141592809195/user
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-wrgqmozczlsgggiltsktnubjiwqdnzxm; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453751997.42-28141592809195/user; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453751997.42-28141592809195/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [127.0.0.1] => {"append": false, "changed": false, "comment": "ircd", "group": 39, "home": "/var/run/ircd", "invocation": {"module_args": {"append": false, "comment": null, "createhome": true, "expires": null, "force": false, "generate_ssh_key": null, "group": null, "groups": null, "home": null, "login_class": null, "move_home": false, "name": "irc", "non_unique": false, "password": null, "remove": false, "shell": null, "skeleton": null, "ssh_key_bits": "2048", "ssh_key_comment": "ansible-generated on vagrant", "ssh_key_file": null, "ssh_key_passphrase": null, "ssh_key_type": "rsa", "state": "present", "system": false, "uid": null, "update_password": "always"}, "module_name": "user"}, "move_home": false, "name": "irc", "shell": "/usr/sbin/nologin", "state": "present", "uid": 39}

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=2    changed=0    unreachable=0    failed=0  

vagrant@vagrant:~$ sudo reboot
vagrant@vagrant:~$
Broadcast message from vagrant@vagrant
    (/dev/pts/0) at 19:59 ...

The system is going down for reboot NOW!
Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
basti /tmp/test $  vagrant ssh
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon Jan 25 19:59:57 2016 from 127.0.0.1
vagrant@vagrant:~$ ansible-playbook --sudo -i hosts  default.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
1 plays in default.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453752033.61-255131124518409 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453752033.61-255131124518409 )" )'
<127.0.0.1> PUT /tmp/tmpWuVdyn TO /home/vagrant/.ansible/tmp/ansible-tmp-1453752033.61-255131124518409/setup
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-ujfmzjtjprnybeysiwduqcnziorotoma; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453752033.61-255131124518409/setup; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453752033.61-255131124518409/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [127.0.0.1]

TASK [test] ********************************************************************
task path: /home/vagrant/default.yml:3
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453752034.25-251224463104142 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453752034.25-251224463104142 )" )'
<127.0.0.1> PUT /tmp/tmp_JWcYK TO /home/vagrant/.ansible/tmp/ansible-tmp-1453752034.25-251224463104142/user
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-xdwzqkcbxmntnidstjypazillxojmsgv; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1453752034.25-251224463104142/user; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1453752034.25-251224463104142/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
changed: [127.0.0.1] => {"append": false, "changed": true, "comment": "ircd", "group": 39, "home": "/var/run/ircd", "invocation": {"module_args": {"append": false, "comment": null, "createhome": true, "expires": null, "force": false, "generate_ssh_key": null, "group": null, "groups": null, "home": null, "login_class": null, "move_home": false, "name": "irc", "non_unique": false, "password": null, "remove": false, "shell": null, "skeleton": null, "ssh_key_bits": "2048", "ssh_key_comment": "ansible-generated on vagrant", "ssh_key_file": null, "ssh_key_passphrase": null, "ssh_key_type": "rsa", "state": "present", "system": false, "uid": null, "update_password": "always"}, "module_name": "user"}, "move_home": false, "name": "irc", "shell": "/usr/sbin/nologin", "state": "present", "uid": 39}

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

Expected Results:

No "changed" task of the playbook run after a reboot.

Actual Results:

"changed" task of the playbook run after a reboot.

@ansibot
Copy link

ansibot commented Jul 31, 2016

@grossws ping, this issue is waiting for your response.
click here for bot help

@ansibot
Copy link

ansibot commented Sep 9, 2016

@grossws, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Oct 6, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

2 similar comments
@ansibot
Copy link

ansibot commented Oct 22, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Nov 6, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Nov 22, 2016

@ansible, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Dec 7, 2016

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

@rndmh3ro
Copy link
Author

rndmh3ro commented Dec 8, 2016

This issue was moved to ansible/ansible#19004

@rndmh3ro rndmh3ro closed this as completed Dec 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants