Commit Graph

684 Commits (d94cc3568a81596572fabed6a7f0e6d1486b71ca)

Author SHA1 Message Date
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
kustodian 447c625cb3 Set selinux state to 'permissive' for state=disabled 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
Jonathan Mainguy 8c05023be3 Fixed hostname for rhel5 python 2.4.3 2016-12-08 11:22:33 -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
Michael Scherer 104f91ed3b Revert commit cbc417c, as the code is broken, see #438
LooseVersion expect a string, so filtering to return a int
is incorrect. Thanks to Jeremy Brown for the analysis.
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
Brian Coca 6d56767454 fixed hostname for gentoo 2016-12-08 11:22:32 -05:00
Brian Coca 77ec45e3d1 vastly simplified systemd detection, made enable/disable errors clearer both of which allows us to remove 'service name detection' as if systemd is init we still use it to handle initscripts. 2016-12-08 11:22:31 -05:00
Brian Coca 8b9772565e now actually adds usable name for systemd when service only has init script 2016-12-08 11:22:31 -05:00
Toshio Kuratomi cd7cc07e85 Gixes to doc formatting 2016-12-08 11:22:31 -05:00
Toshio Kuratomi 7ff9b3990a Update cron example for setting to run twice a day
Fixes #415
2016-12-08 11:22:31 -05:00
Brian Coca ab96ff8b6d service cleanup 2016-12-08 11:22:30 -05:00
Patrik Lundin 8a6a4a7757 Simplify self.arguments logic.
Strange logic pointed out by @jarmani, thanks!
2016-12-08 11:22:30 -05:00
Patrik Lundin 2b18e544f5 Depend more on rcctl if it is present.
* Make the module support enable/disable of special services like pf via rcctl.
  Idea and method from @jarmani.
* Make the module handle when the user supplied 'arguments' variable does not
  match the current flags in rc.conf.local.
* Update description now that the code tries to use rcctl for everything if it
  is available.
2016-12-08 11:22:30 -05:00
Patrik Lundin 25c3c03a11 Tweak error checking for "enabled" code.
Based on input from @jarmani:
* A return value of 2 now means a service does not exist. Instead of
  trying to handle the different meanings of rc after running "status",
  just look at stderr to know if something failed.
* Skip looking at stdout to make the code cleaner. Any errors should
  turn up on stderr.
2016-12-08 11:22:30 -05:00
Patrik Lundin 32cb025b85 Fail if "rcctl status" writes to stderr. 2016-12-08 11:22:30 -05:00
Patrik Lundin 03d4b76b14 Check rc and print error message if any.
It is probably good to use stdout before printing a generic error
message as well.
2016-12-08 11:22:29 -05:00
Patrik Lundin 38d8db473f Make "enabled" code aware of --check mode. 2016-12-08 11:22:29 -05:00
Jonathan Armani d1433eca14 Add enable / disable of services for OpenBSD if rcctl is present 2016-12-08 11:22:29 -05:00
Achilleas Pipinellis 872f6aa559 Clarify supported init systems. 2016-12-08 11:22:28 -05:00
Pascal Borreli 187b07e6c0 Fixed typo 2016-12-08 11:22:28 -05:00
Fabrice Bernhard 3d437b068e Typo in comments
Credit goes to @kbsali
@pborreli : you did not see that one? :-)
2016-12-08 11:22:28 -05:00
Brian Coca 78fb3217d6 service now detects systemd is actually running, not just installed 2016-12-08 11:22:27 -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
Robert Estelle 4e2d05b1f3 Remove incorrect executable permissions. 2016-12-08 11:22:26 -05:00
Brian Coca c071d6a85c switched to iterator as per comments 2016-12-08 11:22:25 -05:00
Martijn P. Rijkeboer fcf527557d Fix whitespace around '=' in sysctl.conf. 2016-12-08 11:22:25 -05:00
Brian Coca a91b5fc170 made hostname work with python 2.4 2016-12-08 11:22:25 -05:00
Toshio Kuratomi 1429507489 Fix for systemd service scripts with newlines
Fixes #127
2016-12-08 11:22:24 -05:00
Michael DeHaan ef2a2b9093 package files 2016-12-08 11:22:22 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00
Michael DeHaan c7eec45b73 Restructuring. 2016-12-08 11:22:22 -05:00