community / community.general / 1.3.14 / module / cronvar Manage variables in crontabs Authors: Doug Luce (@dougluce)community.general.cronvar (1.3.14) — module
Install with ansible-galaxy collection install community.general:==1.3.14
collections: - name: community.general version: 1.3.14
Use this module to manage crontab variables.
This module allows you to create, update, or delete cron variable definitions.
- name: Ensure entry like "EMAIL=doug@ansibmod.con.com" exists community.general.cronvar: name: EMAIL value: doug@ansibmod.con.com
- 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
name: description: - Name of the crontab variable. required: true type: str user: description: - The specific user whose crontab should be modified. - This parameter defaults to C(root) when unset. type: str state: choices: - absent - present default: present description: - Whether to ensure that the variable is present or absent. type: str value: description: - The value to set this variable to. - Required if C(state=present). type: str backup: default: false description: - If set, create a backup of the crontab before it is modified. The location of the backup is returned in the C(backup) variable by this module. type: bool cron_file: description: - If specified, uses this file instead of an individual user's crontab. - Without a leading C(/), this is assumed to be in I(/etc/cron.d). - With a leading C(/), this is taken as absolute. type: str insertafter: description: - If specified, the variable will be inserted after the variable specified. - Used with C(state=present). type: str insertbefore: description: - Used with C(state=present). If specified, the variable will be inserted just before the variable specified. type: str