name cron

pull/38766/merge
Brian Coca 7 years ago
parent 135ec86eb5
commit 3b7f5aef07

@ -135,42 +135,39 @@ author:
""" """
EXAMPLES = ''' EXAMPLES = '''
# Ensure a job that runs at 2 and 5 exists. - name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
# Creates an entry like "0 5,2 * * ls -alh > /dev/null" cron:
- cron:
name: "check dirs" name: "check dirs"
minute: "0" minute: "0"
hour: "5,2" hour: "5,2"
job: "ls -alh > /dev/null" job: "ls -alh > /dev/null"
# Ensure an old job is no longer present. Removes any job that is prefixed - name: 'Ensure an old job is no longer present. Removes any job that is prefixed by "#Ansible: an old job" from the crontab'
# by "#Ansible: an old job" from the crontab cron:
- cron:
name: "an old job" name: "an old job"
state: absent state: absent
# Creates an entry like "@reboot /some/job.sh" - name: Creates an entry like "@reboot /some/job.sh"
- cron: cron:
name: "a job for reboot" name: "a job for reboot"
special_time: reboot special_time: reboot
job: "/some/job.sh" job: "/some/job.sh"
# Creates an entry like "PATH=/opt/bin" on top of crontab - name: Creates an entry like "PATH=/opt/bin" on top of crontab
- cron: cron:
name: PATH name: PATH
env: yes env: yes
value: /opt/bin value: /opt/bin
# Creates an entry like "APP_HOME=/srv/app" and insert it after PATH - name: Creates an entry like "APP_HOME=/srv/app" and insert it after PATH declaration
# declaration cron:
- cron:
name: APP_HOME name: APP_HOME
env: yes env: yes
value: /srv/app value: /srv/app
insertafter: PATH insertafter: PATH
# Creates a cron file under /etc/cron.d - name: Creates a cron file under /etc/cron.d
- cron: cron:
name: yum autoupdate name: yum autoupdate
weekday: 2 weekday: 2
minute: 0 minute: 0
@ -179,14 +176,14 @@ EXAMPLES = '''
job: "YUMINTERACTIVE: 0 /usr/sbin/yum-autoupdate" job: "YUMINTERACTIVE: 0 /usr/sbin/yum-autoupdate"
cron_file: ansible_yum-autoupdate cron_file: ansible_yum-autoupdate
# Removes a cron file from under /etc/cron.d - name: Removes a cron file from under /etc/cron.d
- cron: cron:
name: "yum autoupdate" name: "yum autoupdate"
cron_file: ansible_yum-autoupdate cron_file: ansible_yum-autoupdate
state: absent state: absent
# Removes "APP_HOME" environment variable from crontab - name: Removes "APP_HOME" environment variable from crontab
- cron: cron:
name: APP_HOME name: APP_HOME
env: yes env: yes
state: absent state: absent

Loading…
Cancel
Save