Commit Graph

69 Commits (b46c0985813b9b2e2b1d6b4472bdf4f0904bdc5f)

Author SHA1 Message Date
Anton Kasimov 2e392f47c8 Bugfix for setting user groups on OpenBSD 2017-05-22 18:16:28 -04:00
taksekine b04df23da2 fix #24429 (#24491) 2017-05-11 13:59:39 -07:00
Toshio Kuratomi a31e9bd9ea Really minor optimization and style change for d0e3d75381
* Use a generator expression instead of a list comprehension
* Use copy() to create a new set instead of the constructor.
2017-04-19 10:24:42 -07:00
Bart van Bragt d0e3d75381 Remove whitespace from unix group names 2017-04-19 09:42:00 -07:00
Toshio Kuratomi eb1214baad New metadata 1.0 (#22587)
Changes to the metadata format were approved here:
https://github.com/ansible/proposals/issues/54
* Update documentation to the new metadata format
* Changes to metadata-tool to account for new metadata
  * Add GPL license header
  * Add upgrade subcommand to upgrade metadata version
  * Change default metadata to the new format
  * Fix exclusion of non-modules from the metadata report
* Fix ansible-doc for new module metadata
* Exclude metadata version from ansible-doc output
* Fix website docs generation for the new metadata
* Update metadata schema in valiate-modules test
* Update the metadata in all modules to the new version
2017-03-14 09:07:22 -07:00
Kamil Cholewiński ec9582fd83 Fix invocations of module.fail_json with no msg=
Bonus: add missing % in cs_nic.py
2017-03-07 10:17:14 -05:00
Matt Martz 305c88700d PEP8 E712 fixes (#21916) 2017-02-24 16:49:43 -06:00
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 2017-01-30 15:01:47 -08:00
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
2017-01-29 07:28:53 +00:00
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
2017-01-28 00:12:11 -08:00
Matt Clay d913f69ba1 PEP 8 W291 whitespace cleanup. 2017-01-27 17:08:02 -08:00
Jasper Lievisse Adriaanse 0988de8c4c Remove outdated requirements and add a note trying to reflect reality. 2017-01-13 12:16:23 -05:00
Rezart Qelibari 507b96ff30 user: make system=yes work on Darwin systems. (#19464)
* Update system/user.py module.

Add ability to add real system users with next free system uid (< 500) on macOS.

* Improve syntax in system/user.py module.

Remove complex if else line and replace by simple comparison which yields the same boolean value.

* Remove "True" comparison of user.py.

Remove comparison to true, as it is not pep8 conform.
2016-12-19 16:35:56 -05:00
Michael Scherer 6ffd494efb Cleanup imports for user
Some class use shutil, who was not imported, and we want to
avoid '*' for future refactoring.
2016-12-13 11:53:18 -05:00
James Cammarata 8afa090417 Resolving differences in core modules post-merge 2016-12-08 11:25:36 -05:00
Toshio Kuratomi 7319104552 Refreshed metadata for core modules 2016-12-08 11:25:35 -05:00
Dag Wieers c843eeabc2 Performance improvement using in-operator for hash lookups
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .has_key()
http://stackoverflow.com/questions/1323410/has-key-or-in
2016-12-08 11:25:31 -05:00
Sam Doran b56a9852ee Examples syntax batch4 (#5620)
* Change example syntax on authorized_key module

* Change example syntax on cron module

* Change example syntax on group module

* Change example syntax on hostname module

* Change example syntax on seboolean module

* Change example syntax on selinux module

* Change example syntax on service module

* Change example syntax on sysctl module

* Change example syntax on systemd module

* Change example syntax on user module

* Change example syntax on debug module

* Change example syntax on fail module

* Change example syntax on include module

* Change example syntax on include_role module

* Change example syntax on include_vars module

* Change example syntax on pause module

* Change example syntax on wait_for module

* Change example syntax on apache2_module module

* > Change example syntax on django_manage module

* Change example syntax on htpasswd module
2016-12-08 11:25:31 -05:00
Brian Coca 00fbd98f97 dont join when group is none 2016-12-08 11:25:25 -05:00
Brian Coca 97b23c0fb7 docit 2016-12-08 11:25:25 -05:00
Brian Coca 52332f5b78 allow groups to be passed as YAML list as well
keeps backwards copat with 'comma delimited string'
fixes #5163
2016-12-08 11:25:25 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
Lars Engels 8010b7f980 Add support for password aging on Solaris (#4372)
* Add support for password aging on Solaris

* Fix shadow file editing when {MIN,MAX,WARN}WEEKS is not set in /etc/default/passwd

* Un-break with python3

* _Really_ un-break with python3
2016-12-08 11:25:12 -05:00
Michael Scherer f2b6c7b6a2 Fix user module under python3 (#4560)
Using something like:

    - name: Create ssh keys
      user:
        name: root
        generate_ssh_key: yes
      register: key

result into this traceback on F24

    Traceback (most recent call last):
      File \"/tmp/ansible_jm5d4vlh/ansible_module_user.py\", line 2170, in <module>
        main()
      File \"/tmp/ansible_jm5d4vlh/ansible_module_user.py\", line 2108, in main
        (rc, out, err) = user.modify_user()
      File \"/tmp/ansible_jm5d4vlh/ansible_module_user.py\", line 660, in modify_user
        return self.modify_user_usermod()
      File \"/tmp/ansible_jm5d4vlh/ansible_module_user.py\", line 417, in modify_user_usermod
        has_append = self._check_usermod_append()
      File \"/tmp/ansible_jm5d4vlh/ansible_module_user.py\", line 405, in _check_usermod_append
        lines = helpout.split('\\n')
    TypeError: a bytes-like object is required, not 'str'
2016-12-08 11:24:56 -05:00
Levi Morales 0c9d895438 Fixes #2322 fix for missing append check on Darwin systems (#4256) 2016-12-08 11:24:55 -05:00
jctanner 6c439a4882 user: Cast all arguments to string before passing to run_command (#4398)
Fixes #4397
2016-12-08 11:24:50 -05:00
Brian Coca 16ccde49ad remove X bit 2016-12-08 11:24:49 -05:00
Michael Scherer 3c2110215c Do not hardcode default ssh key size for RSA (#4074)
By default, ssh-keygen will pick a suitable default for ssh keys
for all type of keys. By hardocing the number of bits to the
RSA default, we make life harder for people picking Elliptic
Curve keys, so this commit make ssh-keygen use its own default
unless specificed otherwise by the playbook
2016-12-08 11:24:47 -05:00
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