Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running ansible-playbook

Tags:

ubuntu

ansible

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?

like image 752
mll Avatar asked Aug 22 '13 16:08

mll


3 Answers

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!!!

like image 90
Andrei Krasutski Avatar answered Oct 20 '22 12:10

Andrei Krasutski


For me, the problem was solved by removing "execute" permission on the ansible files (playbook, inventories etc):

find . -type f -exec chmod -x {} \;
like image 29
Chris Beach Avatar answered Oct 20 '22 11:10

Chris Beach


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
like image 5
amine Avatar answered Oct 20 '22 10:10

amine