ansible / ansible.builtin / v2.9.27 / module / cronvar Manage variables in crontabs | "added in version" 2.0 of ansible.builtin" Authors: Doug Luce (@dougluce) preview | supported by communityansible.builtin.cronvar (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
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 cronvar: name: EMAIL value: doug@ansibmod.con.com
- name: Ensure a variable does not exist. This may remove any variable named "LEGACY" cronvar: name: LEGACY state: absent
- name: Add a variable to a file under /etc/cron.d 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