community.general.cronvar – Manage variables in crontabs
community.general.cronvar – Manage variables in crontabs
Note
This plugin is part of the community.general collection (version 2.0.1).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.cronvar
.
Synopsis
- Use this module to manage crontab variables.
- This module allows you to create, update, or delete cron variable definitions.
Requirements
The below requirements are needed on the host that executes this module.
- cron
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
backup boolean |
|
If set, create a backup of the crontab before it is modified. The location of the backup is returned in the |
cron_file string |
If specified, uses this file instead of an individual user's crontab. Without a leading With a leading | |
insertafter string |
If specified, the variable will be inserted after the variable specified. Used with | |
insertbefore string |
Used with | |
name string / required |
Name of the crontab variable. | |
state string |
|
Whether to ensure that the variable is present or absent. |
user string |
The specific user whose crontab should be modified. This parameter defaults to | |
value string |
The value to set this variable to. Required if |
Examples
- name: Ensure entry like "[email protected]" exists
community.general.cronvar:
name: EMAIL
value: [email protected]
- name: Ensure a variable does not exist. This may remove any variable named "LEGACY"
community.general.cronvar:
name: LEGACY
state: absent
- name: Add a variable to a file under /etc/cron.d
community.general.cronvar:
name: LOGFILE
value: /var/log/yum-autoupdate.log
user: root
cron_file: ansible_yum-autoupdate
Authors
- Doug Luce (@dougluce)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/general/cronvar_module.html