ansible / ansible.builtin / v2.4.3.0-1 / 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.4.3.0-1) — module
pip
Install with pip install ansible==2.4.3.0.post1
Use this module to manage crontab variables. This module allows you to create, update, or delete cron variable definitions.
# Ensure a variable exists. # Creates an entry like "EMAIL=doug@ansibmod.con.com" - cronvar: name: EMAIL value: doug@ansibmod.con.com
# Make sure a variable is gone. This will remove any variable named # "LEGACY" - cronvar: name: LEGACY state: absent
# Adds 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: default: null description: - Name of the crontab variable. required: true user: default: root description: - The specific user whose crontab should be modified. required: false state: choices: - present - absent default: present description: - Whether to ensure that the variable is present or absent. required: false value: default: null description: - The value to set this variable to. Required if state=present. required: false 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. required: false cron_file: default: null description: - 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 insertafter: default: null description: - Used with C(state=present). If specified, the variable will be inserted after the variable specified. required: false insertbefore: default: null description: - Used with C(state=present). If specified, the variable will be inserted just before the variable specified. required: false