Running playbook from a cron jobs fails

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

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

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

check the python path

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