Reputation: 505
I've installed Ansible 1.2.3 on Ubuntu Precise 64.
Running ansible-playbook -i ansible_hosts playbook.yml
give me this error:
ERROR: problem running ansible_hosts --list ([Errno 8] Exec format error)
Here's the content of ansible_hosts
:
[development]
localhost ansible_connection=local
and playbook.yml
:
---
- hosts: development
sudo: yes
tasks:
- name: install curl
apt: pkg=curl update_cache=yes
How can I make this work?
Upvotes: 12
Views: 20443
Reputation: 5257
I have a similar problem:
$ ansible --version
ansible 1.5.4
$ ansible-playbook -i hosts main.yml
ERROR: problem running /mnt/d/Works/ansible-zipkin/hosts --list ([Errno 8] Exec format error)
My steps for Debian/Ubuntu:
$ sudo apt-get purge ansible
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible
$ ansible --version
ansible 2.2.1.0
$ ansible-playbook -i hosts main.yml
Now it works!!!
Upvotes: 11
Reputation: 3886
This is fixed with ansible 2.0 https://github.com/ansible/ansible/issues/10068
Upvotes: 0
Reputation: 16394
I ran into this and solved it by using shell
instead of command
.
Upvotes: 1
Reputation: 522
you have to remove execution rights on ansible_hosts
chmod a-x ansible_hosts
if this doesn't work. try it with sudo
sudo chmod a-x ansible_hosts
Upvotes: 6
Reputation: 1053
Execute permissions are used for dynamic inventory scripts like for example rax.py
.
This one in particular builds an inventory by getting it from RackSpace.
If you're maintaining your inventory manually your inventory file should not be executable.
Upvotes: 3
Reputation: 4392
For me, the problem was solved by removing "execute" permission on the ansible files (playbook, inventories etc):
find . -type f -exec chmod -x {} \;
Upvotes: 22
Reputation: 1111
I am just learning ansible. From the best of my knowledge, it seems apt module does not have a key named 'pkg'. Probably, what you are looking for is 'name' [1]
I think, changing following line
apt: pkg=curl update_cache=yes
with
apt: name=curl update_cache=yes
should solve the problem.
Ref: http://docs.ansible.com/apt_module.html
Upvotes: -1