# Running playbook from a cron jobs fails

**URL:** <https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [January 26, 2016, 9:51am UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350 "2016-01-26T09:51:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uwe\_Kruse](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@Uwe\_Kruse](https://forum.ansible.com/u/Uwe_Kruse)\
**Post date:** [January 26, 2016, 9:51am UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350/1 "2016-01-26T09:51:27Z")

</div>

Hello, i try to run an ansible playbook every day and i use cron.  
i get the following error:

- sshpass -p xxxxxxxxx ansible-playbook -i all\_actual\_sp3\_hosts.txt uk\_key.yml --ask-pass -c paramiko  
Traceback (most recent call last):  
File “/usr/bin/ansible-playbook”, line 323, in   
sys.exit(main(sys.argv[1:]))  
File “/usr/bin/ansible-playbook”, line 112, in main  
utils.check\_mutually\_exclusive\_privilege(options, parser)  
AttributeError: ‘module’ object has no attribute ‘check\_mutually\_exclusive\_privilege’
- ansible-playbook -i all\_actual\_sp3\_hosts.txt paketliste.yml  
Traceback (most recent call last):  
File “/usr/bin/ansible-playbook”, line 323, in   
sys.exit(main(sys.argv[1:]))  
File “/usr/bin/ansible-playbook”, line 112, in main  
utils.check\_mutually\_exclusive\_privilege(options, parser)  
AttributeError: ‘module’ object has no attribute ‘check\_mutually\_exclusive\_privilege’
- ansible alle -i all\_actual\_sp3\_hosts.txt -m setup --tree /home/kruseu/setup  
Traceback (most recent call last):  
File “/usr/bin/ansible”, line 195, in   
(options, args) = cli.parse()  
File “/usr/bin/ansible”, line 86, in parse  
utils.check\_mutually\_exclusive\_privilege(options, parser)  
AttributeError: ‘module’ object has no attribute ‘check\_mutually\_exclusive\_privilege’  
?

When i run it in a ssh-session everything works fine.

What can i do to run the playbook inside a cron job?

Ansible runs in a Ubuntu 14.04 system. The ansible version is 1.9.0.1-1.

Greetings Uwe Kruse

---

<div class="post-metadata">

**Author:** ![Abhishek\_R](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Abhishek\_R](https://forum.ansible.com/u/Abhishek_R)\
**Post date:** [January 26, 2016, 6:55pm UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350/2 "2016-01-26T18:55:27Z")

</div>

Perhaps you should provide the details of the playbook as well here. There are many possibilities. For example, this can happen due to the ssh user in the cron. When you run the playbook in a ssh session, you are running with you as the logged-in user. The cron user must have similar privileges on the remote host (if you are using passwordless ssh setup, for instance) for it to succeed.

Regards

---

<div class="post-metadata">

**Author:** ![Uwe\_Kruse](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@Uwe\_Kruse](https://forum.ansible.com/u/Uwe_Kruse)\
**Post date:** [January 27, 2016, 7:25am UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350/3 "2016-01-27T07:25:30Z")

</div>

Hello, i tried some playbook runs with an without paramiko. There ist always the same problem and i think that the module ansible-playbook has th root cause. I use the same user in the ssh and the cron session so the privileges on the remote host are the same. May be my local environment is not the same in an cron session. Which parameter of my online environment can be so important?  
Regards Uwe

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 27, 2016, 7:35pm UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350/4 "2016-01-27T19:35:43Z")

</div>

check the python path

---

<div class="post-metadata">

**Author:** ![Uwe\_Kruse](https://avatars.discourse-cdn.com/v4/letter/u/e47c2d/32.png) [@Uwe\_Kruse](https://forum.ansible.com/u/Uwe_Kruse)\
**Post date:** [February 1, 2016, 12:18pm UTC](https://forum.ansible.com/t/running-playbook-from-a-cron-jobs-fails/20350/5 "2016-02-01T12:18:35Z")

</div>

Hello, the problem was that i had different Versions of ansible installed on the system. One with python pip and one with apt. I removed all ansible packages and did a fresh install.  
Then everything was ok. Thank you, Uwe
