no ansible output when vagrantfile uses ansible_local

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

no ansible output when vagrantfile uses ansible_local

john-2
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


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/03eb9c03-54bf-4d67-8996-20d1c96e1ec7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: no ansible output when vagrantfile uses ansible_local

Gilles Cornu
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


Le vendredi 15 septembre 2017 09:03:54 UTC+2, [hidden email] a écrit :
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: <a href="http://127.0.0.1:2222" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A2222\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDMf4nZFyTM9RaesKetxBX0M9SrQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A2222\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDMf4nZFyTM9RaesKetxBX0M9SrQ&#39;;return true;">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 <a href="https://www.vagrantup.com/docs/provisioning/ansible_local.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fprovisioning%2Fansible_local.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjuUmseq583YURbyyvyi77GGEthw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fprovisioning%2Fansible_local.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHjuUmseq583YURbyyvyi77GGEthw&#39;;return true;">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


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c34b57cd-c257-4220-b3c7-5350b8533e0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.