1
votes

I am trying to provision some development environments with Vagrant + Ansible. I am using OSX as host and CentOS 5.6 as guest.

This is my Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "centos56"

  config.vm.box_url = "http://dl.dropbox.com/u/9227672/centos-5.6-x86_64-netinstall-4.1.6.box"

  config.vm.provision "ansible" do |ansible|
    ansible.playbook  = "playbook.yml"
    ansible.verbose = true
  end

end

This is my playbook:

---
- hosts: all
  tasks:
    - name: PING
      command: ping 127.0.0.1 

This is the error:

~/dev/vms/wlsCluster/master2> vagrant provision
[default] Running provisioner: ansible...

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
fatal: [default] => {'msg': "FAILED: (25, 'Inappropriate ioctl for device')", 'failed': True}

TASK: [PING] ****************************************************************** 
FATAL: no hosts matched or all hosts have already failed -- aborting


PLAY RECAP ******************************************************************** 
       to retry, use: --limit @/Users/brunajardim/playbook.retry

default                    : ok=0    changed=0    unreachable=1    failed=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

I have read that it might be something related to private keys. And that I could use a parameter like *--private-key=$HOME/.vagrant.d/insecure_private_key* to solve the problem. Now, how do I use the vagrant provision command with ansible and pass this parameter to it?

4
Why are you trying to run ping as a command instead of using the ping module? Have you tried a simpler command to be sure basic connectivity is working, something like command: lsjoemaller

4 Answers

1
votes

Miraculously, things just started working as I updated my Vagrant and my Ansible versions. I really don't know what happened. Now I am running on Vagrant 1.3.5 and Ansible 1.4 (devel 6008ea40ee).

Thanks everyone for the answers.

1
votes

The 'Inappropriate ioctl for device' error message occurs if Ansible attempts to prompt you for input (for whatever reason), in a non-interactive environment such as a Jenkins build. The missing 'device' here is the TTY.

Presumably Ansible was prompting you to confirm the host key or password.

0
votes

You've stated that you're on OSX so this shouldn't be an issue, but it's worth looking into and may help others with the same "Inappropriate ioctl for device" error.

On Windows, this can mean that you have an issue with CRLF line endings in one or more of your files. If you're using Eclipse you can convert line endings under File->Convert Line Delimiters. Perhaps have your editor show whitespace characters and that may show you what the line endings are.

Converting the Vagrantfile to the correct line endings solved those errors in my provisioning (though on Windows I had to use the shell provisioner to launch Ansible on the guest VM) as well as strange errors of "dpkg-reconfigure: unable to re-open stdin: No file or directory"

0
votes

Although you have solved this problem, but for future reference, please add the private key to the Vagrantfile like this:

config.ssh.private_key_path = "$HOME/.vagrant.d/insecure_private_key"