summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/system/cron.py
Commit message (Collapse)AuthorAgeFilesLines
* Downgraded more modules from Curated to Community (#24751)Dylan Silva2017-05-181-1/+1
|
* cron: don't force changed=True when old crontab was emptyEvgeni Golov2017-03-281-1/+1
| | | | | | | | | | | | | | | | | The cron module forces changed=True when there was no real change, but the original crontab did not contain a final newline, which is mandatory. When the user has no crontab or the user does not exist at all, crontab -l exits with 1 and the cron module correctly interprets this as "no crontab" and stores the old crontab as "". However this triggers changed=True, even if we're not going to change anything, e.g. when removing a crontab entry from a user who has no crontabs at all. Let's special-case the fact that the old crontab is empty and not force changed=True in that case.
* New metadata 1.0 (#22587)Toshio Kuratomi2017-03-141-3/+4
| | | | | | | | | | | | | | | | 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
* PEP 8 indent cleanup. (#20800)Matt Clay2017-01-291-3/+3
| | | | | | | | * PEP 8 E121 cleanup. * PEP 8 E126 cleanup. * PEP 8 E122 cleanup.
* Apply SELinux context only if cron_file param existsEvan Kaufman2017-01-091-8/+2
| | | | | | Use selinux calls in module_utils/basic instead of native selinux bindings Fixes #18768
* Resolving differences in core modules post-mergeJames Cammarata2016-12-081-3/+3
|
* Refreshed metadata for core modulesToshio Kuratomi2016-12-081-0/+4
|
* Call main in conditional way - systemFabio Alessandro Locati2016-12-081-2/+2
|
* Fix for python 2.4 compatibility (#5693)Evan Kaufman2016-12-081-2/+3
| | | | Fixes #5692
* add correct SELinux file context for crontabs (#4511) (#4595)ekultails2016-12-081-0/+10
|
* Examples syntax batch4 (#5620)Sam Doran2016-12-081-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Identify existing unmanaged jobs by exact match, when no header comment is foundEvan Kaufman2016-12-081-5/+27
| | | | | | | | * updated `find_job` method to find by exact match of job, when no matching header comment is found * note this fallback injects a header comment for later calls to `update_job` or `remove_job` * abstracted header comment building to `do_comment` method Fixes #3256
* Record existing cron file as string property, rather than only recording ↵Evan Kaufman2016-12-081-9/+11
| | | | | | termination This seems less hackish, and feels more proper for diff generation
* Rendering of crontab should reflect actual newline termination, in diff modeEvan Kaufman2016-12-081-3/+3
|
* Ensure trailing newline is written to cron fileEvan Kaufman2016-12-081-3/+12
| | | | | | Records whether existing cron file (or CRONCMD output) has a terminating newline, and ensures a trailing newline is written as necessary EVEN IF NO CHANGE WAS MADE to the target env/job Fixes #2316
* Move job parameter to meet expected requirements (#5151)Steven de Vries2016-12-081-1/+1
| | | | closes #5273
* Bulk spelling improvement to modules-core (#5225)John R Barker2016-12-081-3/+3
| | | | | | | | | | * Correct spelling mistakes * Correct more spelling issues * merge conflict * Revert typo in parms
* cron: replacement for os.getlogin() (#4777)Gregor Giesen2016-12-081-2/+3
| | | | | | | | | | os.getlogin() returns the user logged in on the controlling terminal. However 'crontab' only looks for the login name of the process' real user id which pwd.getpwuid(os.getuid())[0] does provide. While in most cases there is no difference, the former might fail under certain circumstances (e.g. a lxc container connected by attachment without login), throwing the error 'OSError: [Errno 25] Inappropriate ioctl for device'.
* Fixes #3791 cron always returning changed state for multiline jobs (#4285)Evan Kaufman2016-12-081-0/+3
| | | | Strip only newlines and carriage returns. Instead of stripping ALL whitespace, which may have unintended side effects
* Allow cron to target remote user (#4270)BradLook2016-12-081-2/+2
|
* Clarify behaviour when state=present and no name is given (#3904)Thomas Quinot2016-12-081-1/+2
|
* Added statement about escaping characters in chron tasks (#3770)Erik Nadel2016-12-081-0/+1
|
* Fix crontab argument order for writing (#3750)Dmitry Marakasov2016-12-081-1/+1
| | | | | | | | | | | | Currently, when writing user's crontab, ansible calls crontab <file> -u <user> This is incorrect according to crontab(1) on both FreeBSD and Linux, which suggest that file argument should be the last. At least on FreeBSD, this leads to incorrect cron module bahavior which writes to root's crontab instead of users's
* Port cron to a py3 and py24 compatible syntax (#3674)Michael Scherer2016-12-081-4/+4
|
* Add diff and check mode to cron moduleTobias Wolf2016-12-081-6/+38
| | | | | | | supports not writing backup file in check mode and new environment vars. ![example screenshot](http://i.imgur.com/mkAThq8.png)
* Typo.Luca Berruti2016-12-081-1/+1
|
* Allow cron_file to be an absolute pathThomas Quinot2016-12-081-3/+8
| | | | | | | Support specifying an absolute path (typically /etc/crontab) rather than a path relative to /etc/cron.d, to allow modifying the main system crontab. Particularly useful for target systems that have /etc/crontab but no /etc/cron.d.
* cron module: add enviroment variables managementLuca Berruti2016-12-081-40/+168
|
* reverse order of cron commandsBrian Coca2016-12-081-1/+1
| | | | | does not affect linux but fixes issue with busybox caring about order fixes #2807
* Update cron.pyJeroen Seegers2016-12-081-1/+1
| | | | Minor update to documentation for the cron module to reflect the required "name" parameter when the value of "state" is "absent".
* Add missing documentation: cron_file requires user to be setAchilleas Pipinellis2016-12-081-0/+1
|
* removed typoBrian Coca2016-12-081-1/+1
|
* removed syslog in favor of common module logging functionsBrian Coca2016-12-081-11/+3
|
* changed chmod to 2.4 compatBrian Coca2016-12-081-1/+1
|
* Add disabled option to cron moduleEvan Kaufman2016-12-081-8/+22
|
* Fix permissions issue with 'cron' moduleSam Thursfield2016-12-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | I have a task like this in a playbook. The ansible_ssh_user is 'root' for this host. - cron: hour: 00 job: /home/backup/backup.sh name: baserock.org data backup user: backup Running it gave me the following error: TASK: [backup cron job, runs every day at midnight] *************************** failed: [baserock-backup1] => {"failed": true} msg: crontab: can't open '/tmp/crontabvVjoZe': Permission denied crontab: user backup cannot read /tmp/crontabvVjoZe The temporary file created by the 'cron' module is created with the Python tempfile.mkstemp() function. This creates a file that is readable only by 'root' (mode 600). The Busybox `crontab` program then checks if the file is readable by the 'backup' user, and fails if it isn't. So we need to make sure the file is world-readable before running `crontab`.
* - 'name' should not be required so as to allow uninstalling a cron_fileAlexis Seigneurin2016-12-081-2/+2
|
* Proper author info for all remaining modulesGreg DeKoenigsberg2016-12-081-1/+1
|
* Update the cron docs to specify that it takes a boolean valueToshio Kuratomi2016-12-081-1/+2
|
* Fix documentation of the variable that backup file name is returned inToshio Kuratomi2016-12-081-1/+1
|
* Name is a required parameter, fix ↵Michael Scherer2016-12-081-1/+1
| | | | https://github.com/ansible/ansible/issues/10335
* Update cron example for setting to run twice a dayToshio Kuratomi2016-12-081-2/+2
| | | | Fixes #415
* file extensions!Michael DeHaan2016-12-081-0/+524