Things run from cron usually have a very limited set of time environments
variables available to them.
I assume you have no output at all now, so you don't know where to start
looking.

Start by ensuring that you receive any output from cron (pipe to email,
write to log, whatever is appropriate in your use case)

That will reveal the reason why it's not working.



On Wed, 19 Apr 2023 at 18:08, John Welby <[email protected]> wrote:

> ---
> - name: Create a cronjob to patch dev instances
>   hosts: controller
>   tasks:
>     - name: Schedule cron
>       ansible.builtin.cron:
>         name: This cronjob is scheduled by Ansible
>         minute: "15"
>         hour: "12"
>         day: "*"
>         month: "*"
>         weekday: "3"
>         user: ec2-user
>         job: "/home/jwelby/ansible/sub-playbooks/ansible-playbook -i
> dev-hosts /home/jwelby/ansible/sub-playbooks/patching.yml"
>         state: present
>
> crontab -l
>    30 15 * * 3 /home/jwelby/ansible/sub-playbooks/patching.yaml
>
> crond.service is active and running
>
>
> Thanks!
>
> John
> On Wednesday, April 19, 2023 at 10:56:07 AM UTC-4 Will McDonald wrote:
>
>> More information would be helpful here.
>>
>> 1. Can you share your usage of ansible.builtin.cron?
>> 2. Can you share the output of crontab -l for the user you're creating
>> the cron job for/as, or the contents of /etc/crontab and/or /etc/cron.* ?
>> 3. What's in your cronlog or systemd journal?
>> 4. Obvious question but you do have a vixie cron variant installed and
>> the appropriate services started?
>>
>>
>> On Wed, 19 Apr 2023 at 15:26, John Welby <[email protected]> wrote:
>>
>>> All,
>>>
>>> Can a playbook be run by 'job', i.e. instead of a script.
>>>
>>> I created a playbook that creates an entry in crontab, which it does
>>> successfully, but it does not execute the playbook I specified in job:
>>>
>>> Thanks!
>>>
>>> John
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/34c698f9-be82-4e15-a486-3dddb5ebf3ecn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/34c698f9-be82-4e15-a486-3dddb5ebf3ecn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d31172bf-3b3a-4749-882f-437e0401d345n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d31172bf-3b3a-4749-882f-437e0401d345n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from Gmail Mobile

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZZc2bJ7egpef_2pj6L6LbRjrOpGHRUukO_dJ3i6cNt4g%40mail.gmail.com.

Reply via email to