no ansible output when vagrantfile uses ansible_local

33 views
Skip to first unread message

jo...@norricorp.f9.co.uk

unread,
Sep 15, 2017, 3:03:54 AM9/15/17
to Vagrant
Vagrant 2.0.0
virtualbox 5.1.26
host is windows 10, guest is Linux mint 18.2

I have the following vagrant file
    Vagrant.configure("2") do |config|
        config.vm.box = "mint182_vagrant"
        config.vm.provision "ansible_local" do |ansible|
        ansible.playbook = "playbook.yml"
              ansible.install_mode = "pip"
        end
    end

Playbook is
- name: install tuxkart via vagrant with ansible_local
  hosts: all
  sudo: true
  tasks:
    - name: install supertuxkart
      apt: name=supertuxkart update_cache=yes

When I run vagrant up, my VM is created and runs but there is no output for ansible. Ansible has not been installed on the VM. And was not previously on the guest machine.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'mint182_vagrant'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: mint182_base_default_1505458048712_66543
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => D:/Vagrant_examples/mint182_base
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant
Stdout from the command:

Stderr from the command:

Looking at the manual https://www.vagrantup.com/docs/provisioning/ansible_local.html I can't see anything that suggests this will not run from a windows host. 

Regards,
John


Gilles Cornu

unread,
Sep 16, 2017, 5:01:28 AM9/16/17
to Vagrant
Hello John,


==> default: Mounting shared folders...
    default: /vagrant => D:/Vagrant_examples/mint182_base
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p /vagrant

In fact, you haven't reached to execute the "provision" stage, as the "up" steps didn't succeed (failing on creating the synced folder target: /vagrant)
You should first debug this synced folder issue, e.g. by running "vagrant up --no-provision" or "vagrant reload --no-provision". Once it works, you shouldn't have any trouble running the ansible_local provisionner.

About the synced folders and Windows host, see
https://www.vagrantup.com/docs/synced-folders/ and the details about specific file-sharing protocols (e.g. Virtualbox, SMB,...)

Best,
Gilles
Reply all
Reply to author
Forward
0 new messages