ansible - adding crontab entry
by czezz from LinuxQuestions.org on (#5C5BJ)
Im having a problem with ansible while adding entry to crontab for user: user1.
Entry is added, however for some reason between execution time and a command, user1 is added.
Please see following result:
Code:#Ansible: script1.sh
0 1 * * 1 user1 /mnt/sync/script1.shDoes anyone understand what am I doing wrong?
I tried to kick out line: user: user1 but then execution fails.
This is the code of: tasks/script1.yml
Code:---
- name: create file and add crontab entry
file:
path: "/mnt/sync/script1.sh"
state: directory
mode: '0755'
- name: upload script1.sh
copy:
src: "script1.sh"
dest: "/mnt/sync/script1.sh"
mode: 755
owner: user1
group: group1
backup: yes
- name: cron job to for script1.sh
cron:
name: script1
weekday: "1"
hour: "1"
cron_file: "/var/spool/cron/user1"
user: user1
job: "/mnt/sync/script1.sh"


Entry is added, however for some reason between execution time and a command, user1 is added.
Please see following result:
Code:#Ansible: script1.sh
0 1 * * 1 user1 /mnt/sync/script1.shDoes anyone understand what am I doing wrong?
I tried to kick out line: user: user1 but then execution fails.
This is the code of: tasks/script1.yml
Code:---
- name: create file and add crontab entry
file:
path: "/mnt/sync/script1.sh"
state: directory
mode: '0755'
- name: upload script1.sh
copy:
src: "script1.sh"
dest: "/mnt/sync/script1.sh"
mode: 755
owner: user1
group: group1
backup: yes
- name: cron job to for script1.sh
cron:
name: script1
weekday: "1"
hour: "1"
cron_file: "/var/spool/cron/user1"
user: user1
job: "/mnt/sync/script1.sh"