Commit Graph

41 Commits (b06f3bbb22a1fb058aea7abc8c22997c477393c5)

Author SHA1 Message Date
jctanner c952753735 Do not ignore the primary group if modifying the list of secondary groups. (#3585)
Fixes #1118
2016-12-08 11:24:30 -05:00
Michael Scherer f2212dc41a Port user module to python3 and 2.4 compatible syntax (#3673) 2016-12-08 11:24:28 -05:00
Michael Scherer 5b32a299a5 Change home and ssh_key_file to 'path' in user module 2016-12-08 11:24:20 -05:00
jjshoe a160d5426d List which version it was added
fixes https://github.com/ansible/ansible-modules-core/issues/2605
2016-12-08 11:24:05 -05:00
Brian Coca b5c9945485 avoid chmod in check mode 2016-12-08 11:24:04 -05:00
Brian Coca 5aff573098 revamped checkmode support in user module
- defaulted to commands not executing in checkmode
- added force run for info gathering (for setting changed)
- added debug for what would have been run in check mode
- added check mode for spots that made changes using system calls instead of command
- removed now redundant checkmode checks

better failure now, if i missed anything, it will misreport changed value
instead of old default of actually making the change in checkmode
2016-12-08 11:24:04 -05:00
Matt Clay 642746d0a3 Make modify_user_usermod honor check mode on AIX. 2016-12-08 11:24:03 -05:00
Matt Clay 04ad3fe304 Make modify_user honor check mode on OS X. 2016-12-08 11:24:02 -05:00
Matt Clay c87f70429b Make modify_user honor check mode on FreeBSD. 2016-12-08 11:24:01 -05:00
Brian Coca f435f887fa better handling of checkmode for solaris fixes #2296 2016-12-08 11:23:51 -05:00
tobbe 65f12bccb6 add text to the description, more user friendly 2016-12-08 11:23:51 -05:00
tobbe 455da45e62 Add suport for selinux user when adding a new user on selinux enabled systems 2016-12-08 11:23:51 -05:00
nitzmahone 0d0b78dd1e fixed disappearing groups on OSX user module
Ensure that we don't try to modify the groups collection if groups are not specified
2016-12-08 11:23:51 -05:00
Dominique Barton 5c05016d1e bugfix for issue #2537 2016-12-08 11:23:51 -05:00
Toshio Kuratomi 80b3bbd55e Mark a few parameters as no_log 2016-12-08 11:23:42 -05:00
Brian Coca d55ba3ab7c removed syslog in favor of common module logging functions 2016-12-08 11:23:38 -05:00
Mike Boone dd76088019 Updated link to the FAQ. 2016-12-08 11:23:36 -05:00
Marius Gedminas f97d00fbad user: don't generate SSH keys in check mode
Fixes https://github.com/ansible/ansible/issues/11768

Test plan:

- (in a Vagrant VM) created a user 'bob' with no ssh key
- ran the following playbook in check mode:

    ---
    - hosts: trusty
      tasks:
        - user: name=bob state=present generate_ssh_key=yes

- saw that ansible-playbook reported "changes=1"
- saw that /home/bob/.ssh was still absent
- ran the playbook for real
- saw that /home/bob/.ssh was created
- ran the playbook in check mode again
- saw that ansible-playbook reported no changes
- tried a variation with a different username for a user that didn't
  exist: ansible-playbook --check worked correctly (no errors, reported
  "changed")
2016-12-08 11:23:33 -05:00
Sébastien Gross 0fd3ece053 Allow '*' as empty password.
If `password` is defined as `*` `useradd` or `usermod` returns an error:

    msg: usermod: Invalid password: `*'

This works very well on Linux host to not define any password for a
user (mainly useful if your setup is only based on SSH keys for
auth). On OpenBSD this does not work, so we have to ignore the encrypted
password parameter if it defined as `*`.
2016-12-08 11:23:25 -05:00
Brian Coca 7a6c8251dd prevent usless assignment of home 2016-12-08 11:23:22 -05:00
Mischa ter Smitten 10cae0acb3 The tilde expansion doesn't work with user.home 2016-12-08 11:23:21 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
macbeth76 fce97365a4 Update user.py
M in date format is minutes. m is for months.
2016-12-08 11:22:58 -05:00
louis 9d20a3091e added skeleton support in user module 2016-12-08 11:22:57 -05:00
Keith Johnson 06579c560e Make link clickable 2016-12-08 11:22:54 -05:00
James Cammarata 68a07a2bb5 Merge branch 'osx_user_fix' of https://github.com/bambou42/ansible-modules-core into bambou42-osx_user_fix
Includes commits for:
* Don't return change if the password is not set
* Set the group to nogroup if none is specified
* Set an uid if none is specified
* Test if SHADOWFILE is set (for Darwin)
* remove unused uid
2016-12-08 11:22:53 -05:00
Carlo Mandelli 1f93a052d6 Added HP-UX subclass 2016-12-08 11:22:47 -05:00
Oleg A. Mamontov 845b6d78be On FreeBSD apply 'login_class' only if there is real change. 2016-12-08 11:22:45 -05:00
Stefan J. Betz aca24caa19 Create SSH Keys always after creating $HOME 2016-12-08 11:22:44 -05:00
Sébastien Gross 624be0e239 Add basic support for OS X (Darwin) user management. 2016-12-08 11:22:41 -05:00
Paul Geraghty 5f24584010 Correct grammar of comment relating to example 2016-12-08 11:22:41 -05:00
Brian Coca 884471a6b5 implemented account expiration as flag and not state, removed from unsupported platforms 2016-12-08 11:22:40 -05:00
Michael Scherer 0a745de765 Do not use echo shell builtin for password
Using \t in a password may result in a different password
being set :

    $ echo 'a\ta'
    a   a

Problem report originally found by Pilou-
( https://github.com/ansible/ansible-modules-extras/pull/198 )
2016-12-08 11:22:37 -05:00
Toshio Kuratomi e75dc7e5a6 Clarify documented behaviour of user module's ssh_key_file parameter
Fixes #9873
2016-12-08 11:22:37 -05:00
billwanjohi b019076dd3 user: add expired state
ported from
https://github.com/ansible/ansible/pull/6303

It's very useful and routine to disable a *nix user.
I implemented expired instead of locked because this prevents any use of
the account, safer than just preventing password-based authentication.

I have tests [1], but since none of the suite came along with the core
modules, I'm unsure how to submit them.

[1] https://github.com/billwanjohi/ansible/blob/add_locked_state/test/integration/roles/test_user/tasks/main.yml
2016-12-08 11:22:35 -05:00
Michael Scherer 36c653f54a Add hostname to generated user SSH key comment
The default is not very useful to sort between different
keys and user. Adding the hostname in the comment permit to later
sort them if you start to reuse the key and set them in different
servers. See https://github.com/ansible/ansible/pull/7420
for the rational.
2016-12-08 11:22:35 -05:00
Peter Oliver 432a6286db Fix appending to a user's group on Solaris
Without this change, you get:
    AttributeError: 'set' object has no attribute 'extend'

Tested on a Solaris 11.2 client with the included Python 2.6.8.
2016-12-08 11:22:34 -05:00
zitterbacke 1d4808780f re-enable AIX password setting
the AIX class uses a unsafe shell for setting the user password (containing a pipe in the command). This patch adopts to the new behavior of module_utils/basic.py (since somewhere around 1.7).

besides it changes the qoutes for the echo command from double to single, because password-hashes contain $-signs and one would not have this variables expanded.
2016-12-08 11:22:33 -05:00
Toshio Kuratomi e359f7cfcf Don't traceback if a gid is specified instead of a group name
Fixes https://github.com/ansible/ansible/issues/9796
2016-12-08 11:22:33 -05:00
Jonathan Mainguy a71ce0615a fixes user module for rhel5 by using -n instead of -N, all other distros will still use -N 2016-12-08 11:22:27 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00