title: Cron jobs to run an ansible playbook every hour
body: <p>I have been trying to configure a cron job to run my ansible playbook every hour. I could not find any relevant examples on how to start the configuration . I have tried the below task in a separate ansible playbook and it shows the below output for crontab -l, but not execution seems to be happening. Help will be high appreciated.</p>
  <pre><code>root@ubuntu:/etc/ansible/# crontab -l
                           57 10 * * * ansible-playbook crontest.yaml
  </code></pre>
  <pre><code>   - name: Run an ansible playbook&quot;
       cron:
          name: &quot;Run play&quot;
          minute: &quot;57&quot;
          hour: &quot;10&quot;
          job: &quot;ansible-playbook crontest.yaml&quot;
  </code></pre>
  <p><strong>Cron Logs:</strong></p>
  <pre><code>Nov 24 07:35:01 ABC30VDEF290021 CRON[13951]: (root) CMD (echo &quot;testing&quot; &gt; /etc/ansible/automation/logs/test.txt)
  Nov 24 07:35:01 ABC30VDEF290021 CRON[13948]: (root) CMD (                /usr/bin/ansible-playbook /etc/ansible/automation/crontest.yml)
  Nov 24 07:35:01 ABC30VDEF290021 CRON[13949]: (root) CMD (/usr/local/bin/ansible-playbook /etc/ansible/automation/main.yaml)
  
  </code></pre>
  <p><strong>Crontab -e</strong></p>
  <pre><code>#Ansible: Run play
  */1 * * * * /bin/sh -c '. ~/.profile; /usr/local/bin/ansible-playbook /etc/ansible/automation/crontest.yml
  
  */1 * * * * echo &quot;testing&quot; &gt; /etc/ansible/automation/logs/test.txt
  
  35 7 * * * /usr/local/bin/ansible-playbook /etc/ansible/automation/main.yaml
  </code></pre>