Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check mode still makes changes in user module for SunOS clients #5169

Closed
davecore82 opened this issue Dec 5, 2013 · 1 comment
Closed

Check mode still makes changes in user module for SunOS clients #5169

davecore82 opened this issue Dec 5, 2013 · 1 comment
Labels
bug This issue/PR relates to a bug. solaris Solaris community

Comments

@davecore82
Copy link

The check mode for the user module does not work and still makes changes to SunOS/Solaris hosts.

Using ansible 1.3.4

Here are steps to reproduce the problem:

cat site.yml


  • hosts: solaris10
    roles:
    • solaris10
  • hosts: HOSTWITHPROBLEM
    roles:
    • users-sysadmins
  • hosts: solaris11
    roles:
    • solaris11
  • hosts: dbservers
    roles:
    • dbservers

My users-sysadmins role:

ls -lR

.:
total 20
drwxrwxr-x 2 root root 4096 Nov 27 19:15 files
drwxrwxr-x 2 root root 4096 Nov 27 19:14 handlers
drwxrwxr-x 2 root root 4096 Dec 4 15:43 tasks
drwxrwxr-x 2 root root 4096 Nov 27 19:15 templates
drwxrwxr-x 2 root root 4096 Nov 27 19:15 vars

./files:
total 0

./handlers:
total 0
-rw-rw-r-- 1 root root 0 Nov 27 19:14 main.yml

./tasks:
total 4
-rw-rw-r-- 1 root root 424 Dec 4 15:43 main.yml

./templates:
total 0

./vars:
total 0
-rw-rw-r-- 1 root root 0 Nov 27 19:15 main.yml

The yml file for the role:

cat tasks/main.yml


Sysadmin 1

  • name: Creation of group for sysadmin1
    group: name=sysadmin1 gid=524 state=present
    tags: sysadmin1
  • name: Creation of user for sysadmin1
    user: name=sysadmin1 comment="Sysadmin 1" uid=559 append=yes createhome=yes group=sysadmin1 groups=sysadmin home=/export/home/sysadmin1 shell=/usr/bin/bash
    tags: sysadmin1

And I call the playbook like this:

ansible-playbook /etc/ansible/site.yml -i /etc/ansible/dev -u sysadmin1 -k -s -K --limit=HOSTWITHPROBLEM --tags=sysadmin1 --check

And it changes the user for real each time even though I have the --check option.

Additional IRC info:

[23:12] You mentioned that you think the SunOS user module does not support check mode.
[23:13] @jtanner yes
[23:13] Can we be sure of that? What do I need to do to get to the bottom of this? I want to get to the bottom of this so I can get my confidence level back up to continue using Ansible in my production environment
[23:13] @jtanner well, are you connecting to sunos clients?
[23:14] Yes I am, it's a Solaris 10 zone even
[23:15] "ansible_architecture": "sun4v", "ansible_container": "zone", "ansible_distribution": "Solaris", "ansible_distribution_release": "Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC", "ansible_distribution_version": "10",
[23:16] @jtanner the sunos class in the user mode makes zero references to self.module.check_mode so it's probably in need of a refactor
[23:16] @jtanner user module*
[23:17] @jtanner and it's been that way for over a year 3bab27ab
[23:17] @jtanner perhaps check mode wasn't around when romeo wrote the class?
[23:18] @jtanner i can probably fix it pretty quick, but i need a bug first

The check mode should not make changes to the user module.

@davecore82
Copy link
Author

I can also reproduce the problem with this ansible one liner:

ansible myhost -i dev -u myuser -k -s -K -m user -a "name=test comment='comment 4'" -C -vvvv

SSH password:
sudo password [defaults to SSH password]:
ESTABLISH CONNECTION FOR USER: myuser on PORT 22 TO ipaddress
EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1386219964.06-19287607344806 && chmod a+rx $HOME/.ansible/tmp/ansible-1386219964.06-19287607344806 && echo $HOME/.ansible/tmp/ansible-1386219964.06-19287607344806'
REMOTE_MODULE user name=test comment='comment 4' CHECKMODE=True
PUT /tmp/tmp_KPGeq TO /export/home/myuser/.ansible/tmp/ansible-1386219964.06-19287607344806/user
EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=yuglrtsvsshoihmqocbffjhgosjtwnrx] password: " -u root /bin/sh -c '"'"'/usr/bin/python /export/home/myuser/.ansible/tmp/ansible-1386219964.06-19287607344806/user; rm -rf /export/home/myuser/.ansible/tmp/ansible-1386219964.06-19287607344806/ >/dev/null 2>&1'"'"''

myhost | success >> {
"append": false,
"changed": true,
"comment": "comment 4",
"group": 1,
"home": "/home/test",
"name": "test",
"shell": "/bin/sh",
"state": "present",
"uid": 560
}

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@dagwieers dagwieers added the solaris Solaris community label Jan 9, 2019
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. solaris Solaris community
Projects
None yet
Development

No branches or pull requests

3 participants