vagrant ansible with windows vagrant box. cant find winrm.

8 views
Skip to first unread message

pixel fairy

unread,
Jul 12, 2019, 5:30:51 AM7/12/19
to Vagrant
Trying to use ansible to configure a windows vagrant box. host is ubuntu

ansible 2.8.1 (python3)
vagrant 2.2.5
vagrant-libvirt 0.0.45

shell provisioner works (or at least no errors shown), running ConfigureRemotingForAnsible.ps1 from https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

but the ansible provisioner does not work. it complains about missing winrm even though its installed for both python2 and 3. ansible with winrm does work outside of vagrant.

running vagrant up gives me this.

Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.7.10).

Alternatively, the compatibility mode can be specified in your Vagrantfile:

    default: Running ansible-playbook...

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

TASK [Gathering Facts] *********************************************************
fatal: [default]: FAILED! => {"msg": "winrm or requests is not installed: No module named winrm"}
to retry, use: --limit @/home/pixel/vagrant/winping/site.retry

PLAY RECAP *********************************************************************
default                    : ok=0    changed=0    unreachable=0    failed=1   

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


heres the Vagrantfile,

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "peru/windows-server-2012_r2-standard-x64-eval"
  config.vm.hostname = "pingme"
  config.vm.network "private_network", ip: "10.17.18.12"
  config.vm.provision "shell", path: "ConfigureRemotingForAnsible.ps1"
  config.vm.provision "ansible", playbook: "site.yml"
end

and heres site.yml

- hosts: all
  vars:
    ansible_winrm_server_cert_validation: ignore
  tasks:
  - name: ping
    win_ping:



Reply all
Reply to author
Forward
0 new messages