mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 21:54:22 -07:00
cronvar.py: support absolute destinations
Mainly so /etc/crontab can be written to.
This commit is contained in:
parent
c00688a118
commit
d4275e576e
1 changed files with 7 additions and 2 deletions
9
lib/ansible/modules/extras/system/cronvar.py
Normal file → Executable file
9
lib/ansible/modules/extras/system/cronvar.py
Normal file → Executable file
|
@ -70,7 +70,9 @@ options:
|
||||||
default: root
|
default: root
|
||||||
cron_file:
|
cron_file:
|
||||||
description:
|
description:
|
||||||
- If specified, uses this file in cron.d instead of an individual user's crontab.
|
- If specified, uses this file instead of an individual user's crontab.
|
||||||
|
Without a leading /, this is assumed to be in /etc/cron.d. With a leading
|
||||||
|
/, this is taken as absolute.
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
backup:
|
backup:
|
||||||
|
@ -126,7 +128,10 @@ class CronVar(object):
|
||||||
self.wordchars = ''.join(chr(x) for x in range(128) if chr(x) not in ('=', "'", '"', ))
|
self.wordchars = ''.join(chr(x) for x in range(128) if chr(x) not in ('=', "'", '"', ))
|
||||||
|
|
||||||
if cron_file:
|
if cron_file:
|
||||||
self.cron_file = '/etc/cron.d/%s' % cron_file
|
self.cron_file = ""
|
||||||
|
if cron_file[0] != '/':
|
||||||
|
self.cron_file = '/etc/cron.d/'
|
||||||
|
self.cron_file = self.cron_file + cron_file
|
||||||
else:
|
else:
|
||||||
self.cron_file = None
|
self.cron_file = None
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue