community.general/lib/ansible/modules/system
Sam Thursfield cad0adc691 Fix permissions issue with 'cron' module
I have a task like this in a playbook. The ansible_ssh_user is 'root'
for this host.

    - cron:
        hour: 00
        job: /home/backup/backup.sh
        name: baserock.org data backup
        user: backup

Running it gave me the following error:

    TASK: [backup cron job, runs every day at midnight] ***************************
    failed: [baserock-backup1] => {"failed": true}
    msg: crontab: can't open '/tmp/crontabvVjoZe': Permission denied
    crontab: user backup cannot read /tmp/crontabvVjoZe

The temporary file created by the 'cron' module is created with the
Python tempfile.mkstemp() function. This creates a file that is readable
only by 'root' (mode 600). The Busybox `crontab` program then checks if
the file is readable by the 'backup' user, and fails if it isn't. So we
need to make sure the file is world-readable before running `crontab`.
2016-12-08 11:23:28 -05:00
..
__init__.py package files 2016-12-08 11:22:22 -05:00
authorized_key.py fix authorized_keys in check_mode 2016-12-08 11:23:16 -05:00
cron.py Fix permissions issue with 'cron' module 2016-12-08 11:23:28 -05:00
group.py Check if the gid is set 2016-12-08 11:23:22 -05:00
hostname.py Add Solaris support in hostname module 2016-12-08 11:23:26 -05:00
mount.py mount: Support for Check-Mode 2016-12-08 11:23:24 -05:00
ping.py Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
seboolean.py Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
selinux.py Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
service.py Prefer non-zero rc's over text analyis in service status checks 2016-12-08 11:23:26 -05:00
setup.py changed verbose override variable 2016-12-08 11:23:27 -05:00
sysctl.py Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
user.py Allow '*' as empty password. 2016-12-08 11:23:25 -05:00