Commit Graph

104 Commits (62b6cf85d3ffc5ec25a968e80a17503e9e52c5a6)

Author SHA1 Message Date
verm666 ac40d9f41a fix authorized_keys in check_mode
This change is in response to issue #1515.
Original pull request #1580.

The original problem is: in authorized_key module you have no idea about users
which will be created by Ansible at first run. I can propose next two ways to
solve this problem:

  1. Combine modules system/user.py and system/authorized_key.py in one module
     (so you will know everything about users in that module)
  2. Use small workaround: add my commit and always provide 'path' parameter
     for authorized_key module during runs with --check option.
2016-12-08 11:23:16 -05:00
Matt Martz d47de74ade Replaced tabbed indentation with spaces for group module 2016-12-08 11:23:16 -05:00
Brian Coca e91818ef77 updated docs to clarify use of exclusive 2016-12-08 11:23:14 -05:00
Konstantin Gribov 8d91c3a61a Escape spaces, backslashes and ampersands in fstab
Fixes #530.

It's more generic than #578 which only fixes spaces escaping in name (target dir to mount).
Escaping is used in both `set_mount` (important for `src`, `name` and `opts`) and
`unset_mount` (for `name`).

It's shouldn't be used in `mount` and `umount` since `name` parameter is passed as array element
to `module.run_command`.

Signed-off-by: Konstantin Gribov <grossws@gmail.com>
2016-12-08 11:23:14 -05:00
Arata Notsu cc76a479e1 Not use "is" to compare strings
As "is" tests whether if operands are the same object rather than
they have the same value, potentially causes a wrong result.
2016-12-08 11:23:14 -05:00
Alexis Seigneurin 53e9caa1d0 - 'name' should not be required so as to allow uninstalling a cron_file 2016-12-08 11:23:13 -05:00
sysadmin75 f096359608 ansible-modules-core #530 fix - Mount module does not accept spaces in mount point path 2016-12-08 11:23:13 -05:00
Hagai Kariti b46a1ff3e1 Hostname module should update ansible_hostname 2016-12-08 11:23:10 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Brian Coca b2dadaadf8 Revert "added innitial daemon-reloaded support to service module"
This reverts commit 438d87d26991c26de4a6b1457b154eb8f50d093a.
2016-12-08 11:23:06 -05:00
Brian Coca 55d04f4ddf added innitial daemon-reloaded support to service module 2016-12-08 11:23:05 -05:00
Patrik Lundin 899788f1a7 service: Fix comments in OpenBsdService class.
No functional change.
2016-12-08 11:23:02 -05:00
Jonathan Mainguy 20301427f8 fixes check mode for Ubuntu 14.04 2016-12-08 11:23:01 -05:00
Vladislav Lewin 36ce019beb add SLE12 support to hostname.py 2016-12-08 11:23:01 -05:00
Jonathan Mainguy 06cd532cc5 added nice error for systemd hosts where name > 64 chars 2016-12-08 11:23:00 -05:00
Toshio Kuratomi 84110be91d Update the cron docs to specify that it takes a boolean value 2016-12-08 11:23:00 -05:00
Toshio Kuratomi 623f70ecd6 Fix documentation of the variable that backup file name is returned in 2016-12-08 11:23:00 -05:00
Brian Coca b13fd5ac9a value should be string as that is what it compares against 2016-12-08 11:22:59 -05:00
Jonathan Mainguy f4b07b105b added openbsd to hostname module 2016-12-08 11:22:59 -05:00
Semyon Deviatkin e94140e52b Fix unused variable systemd_enabled
Removed declared but unused variable systemd_enabled
2016-12-08 11:22:59 -05:00
Jesse Keating 17aabee6df Add service option to avoid failure on missing service
This adds a must_exist option to the service module, which gives callers the
ability to be tolerant to services that do not exist. This allows for
opportunistic manipulation of a list of services if they happen to exist on the
host. While failed_when could be used, it's difficult to track all the
different error strings that might come from various service tools regarding a
missing service.
2016-12-08 11:22:58 -05:00
Toshio Kuratomi 5336217649 Several cleanups to many modules:
* Fix docs to specify when python2.6+ is required (due to a library
  dep).  This helps us know when it is okay to use python2.6+ syntax in
  the file.
* remove BabyJson returns.  See #1211  This commit fixes all but the
  openstack modules.
* Use if __name__ == '__main__' to only run the main part of the module
  if the module is run as a program.  This allows for the potential to
  unittest the code later.
2016-12-08 11:22:58 -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
James Cammarata d7ce6b0d4b Fix bug in service where upstart services incorrectly use init scripts
Fixes #1170
2016-12-08 11:22:57 -05:00
Evgenii Terechkov 37d6c10133 Add ALT Linux support to hostname module 2016-12-08 11:22:56 -05:00
Michael Scherer f7707ea137 Name is a required parameter, fix https://github.com/ansible/ansible/issues/10335 2016-12-08 11:22:55 -05:00
Brian Coca a6107e35e9 simplified bad if chain hopefully fixes #1136 2016-12-08 11:22:54 -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
David Wittman 15235a718d Fix bug with upstart detection
Upstart scripts are being incorrectly identified as SysV init scripts
due to a logic error in the `service` module.

Because upstart uses multiple commands (`/sbin/start`, `/sbin/stop`,
etc.) for managing service state, the codepath for upstart sets
`self.svc_cmd` to an empty string on line 451.

Empty strings are considered a non-truthy value in Python, so
conditionals which are checking the state of `self.svc_cmd` should
explicitly compare it to `None` to avoid overlooking the fact that
the service may be controlled by an upstart script.
2016-12-08 11:22:52 -05:00
David Fritzsche 14720b54ac Add working status detection for pf on FreeBSD
The return code of "service pf onestatus" is usually zero on FreeBSD (tested with FreeBSD 10.0), even if pf is not running. So the service module always thinks that pf is running, even when it needs to be started.
2016-12-08 11:22:50 -05:00
Sam Thursfield 5d2652f31b Fix authorized_key module crashing when given an invalid key
I tried a playbook with the following (accidentally wrong) task:

  tasks:
      - name: authorized key test
        authorized_key: key=/home/sam/.ssh/id_rsa.pub key_options='command="/foo/bar"' user=sam

I got the following traceback:

    TASK: [authorized key test] ***************************************************
    failed: [localhost] => {"failed": true, "parsed": false}
    Traceback (most recent call last):
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 2515, in <module>
        main()
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 460, in main
        results = enforce_state(module, module.params)
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 385, in enforce_state
        parsed_new_key = (parsed_new_key[0], parsed_new_key[1], parsed_options, parsed_new_key[3])
    TypeError: 'NoneType' object has no attribute '__getitem__'

With this fix, I see the expected error instead:

    TASK: [authorized key test] ***************************************************
    failed: [localhost] => {"failed": true}
    msg: invalid key specified: /home/sam/.ssh/id_rsa.pub
2016-12-08 11:22:50 -05:00
Mario Loria 00613cd4f3 Setting the actual passno and dump defaults, and warning user of consequences in nulling
Using ansible 1.8.4, I found that these two options actually work slightly different than advertised.
2016-12-08 11:22:48 -05:00
Dag Wieers 43ef3a2bd9 Update authorized_key.py
Fix a (common) error in the examples. This is something that may go unnoticed during troubleshooting when copy&pasting the example.
2016-12-08 11:22:46 -05:00
Toshio Kuratomi 9fa04de137 In service_enable, the default of changed is True so we have to set it to False explicitly if it is False.
Fixes #875
2016-12-08 11:22:46 -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
Edward Larkey d17726bae9 Fix typo in authorized key module documentation.
Added opening double quote
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
Brian Coca 2278a69f7b fix for mount w/o opts (bug introduced when fixing bind mounts) 2016-12-08 11:22:43 -05:00
Jon Hadfield 90f5a23f34 use is-enabled to check systemd service status. 2016-12-08 11:22:42 -05:00
Graham Hay 15fcbcb0ee Use insserv where available 2016-12-08 11:22:42 -05:00
Sébastien Gross 164d518370 Add basic support for OSX groups. 2016-12-08 11:22:42 -05:00
Sébastien Gross 624be0e239 Add basic support for OS X (Darwin) user management. 2016-12-08 11:22:41 -05:00
Dagobert Michelsen 9991e8d8f1 Solaris SMF is already supported and should be mentioned in the docs, 2016-12-08 11:22:41 -05:00
Brian Coca 132c43a84f added note that url src is only avaialable from 1.9 on 2016-12-08 11:22:41 -05:00
Toshio Kuratomi 691f4cc049 Tabs to spaces 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
Jesse Keating 6f4273a3ff Add exclusive option to authorized_keys
This option allows the module to ensure that ONLY the specified keys
exist in the authorized_keys file. All others will be removed. This is
quite useful when rotating keys and ensuring no other key will be
accepted.
2016-12-08 11:22:41 -05:00