trying vagrant + ansible for windows server target. cant win_ping

66 views
Skip to first unread message

pixel fairy

unread,
May 3, 2018, 5:17:59 PM5/3/18
to Ansible Project
host: ubuntu-16.04
vagrant: 2.0.4
vagrant-hostmanager (1.8.8)
vagrant-libvirt (0.0.43)
vagrant-mutate (1.2.0)
vagrant-sshfs (1.3.1)

there is a virtualbox version of the same windows box. used pip to update winrm (and also had to use pip for openssl) same results without the pywinrm warning.


VAGRANTFILE_API_VERSION
= "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config
.vm.box = "peru/windows-server-2012-r2-standard-x64-eval"
  config
.vm.provider "libvirt" do |libvirt|
    libvirt
.input type: "tablet", bus: "usb"
    libvirt
.graphics_type = "vnc"
 
end
  config
.vm.provision "shell", path: "ConfigureRemotingForAnsible.ps1"
  config
.vm.provision "ansible", playbook: "site.yml"
end

ansible setup script at https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1

site.yml:
hosts: all
  vars
:
    ansible_winrm_scheme
: http
    ansible_winrm_server_cert_validation
: ignore
  tasks
:
 
- name: ping
    win_ping
:

$ vagrant up

Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'peru/windows-server-2012-r2-standard-x64-eval' is up to date...
==> default: Uploading base box image as volume into libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              winping_default
==> default:  -- Domain type:       kvm
==> default:  -- Cpus:              1
==> default:
==> default:  -- Feature:           acpi
==> default:  -- Feature:           apic
==> default:  -- Feature:           pae
==> default:  -- Memory:            2048M
==> default:  -- Management MAC:    
==> default:  -- Loader:            
==> default:  -- Base box:          peru/windows-server-2012-r2-standard-x64-eval
==> default:  -- Storage pool:      default
==> default:  -- Image:             /var/lib/libvirt/images/winping_default.img (50G)
==> default:  -- Volume Cache:      default
==> default:  -- Kernel:            
==> default:  -- Initrd:            
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     -1
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        qxl
==> default:  -- Video VRAM:        9216
==> default:  -- Sound Type:    ich6
==> default:  -- Keymap:            en-us
==> default:  -- TPM Path:          
==> default:  -- INPUT:             type=tablet, bus=usb
==> default:  -- CHANNEL:             type=unix, mode=
==> default:  -- CHANNEL:             target_type=virtio, target_name=org.qemu.guest_agent.0
==> default:  -- CHANNEL:             type=spicevmc, mode=
==> default:  -- CHANNEL:             target_type=virtio, target_name=com.redhat.spice.0
==> default:  -- RNG device model:  random
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
==> default: Forwarding ports...
==> default: 3389 (guest) => 3389 (host) (adapter eth0)
==> default: 5986 (guest) => 5986 (host) (adapter eth0)
==> default: 5985 (guest) => 55985 (host) (adapter eth0)
==> default: Configuring and enabling network interfaces...
==> default: Running provisioner: shell...
   
default: Running: ConfigureRemotingForAnsible.ps1 as c:\tmp\vagrant-shell.ps1
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the
Ansible version installed (2.5.1).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https
://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

   
default: Running ansible-playbook...

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

TASK
[Gathering Facts] *********************************************************
 
[WARNING]: ansible_winrm_server_cert_validation unsupported by pywinrm (is an
up
-to-date version of pywinrm installed?)

fatal
: [default]: UNREACHABLE! => {"changed": false, "msg": "plaintext: [Errno 104] Connection reset by peer", "unreachable": true}
    to
retry, use: --limit @/home/shared/vagrant/winping/site.retry

PLAY RECAP
*********************************************************************
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.


also tried with ansible_winrm_scheme: https

==> default: Running provisioner: shell...
   
default: Running: ConfigureRemotingForAnsible.ps1 as c:\tmp\vagrant-shell.ps1
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the
Ansible version installed (2.5.1).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https
://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

   
default: Running ansible-playbook...

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

TASK
[Gathering Facts] *********************************************************
 
[WARNING]: ansible_winrm_server_cert_validation unsupported by pywinrm (is an
up
-to-date version of pywinrm installed?)

fatal
: [default]: UNREACHABLE! => {"changed": false, "msg": "ssl: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)", "unreachable": true}
    to
retry, use: --limit @/home/shared/vagrant/winping/site.retry

PLAY RECAP
*********************************************************************
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.

Tom Rota

unread,
May 5, 2018, 5:42:56 AM5/5/18
to ansible...@googlegroups.com
Have you tried letting vagrant bring the box up without running the ansible portion of provisioning, getting your command prompt back, and then running ansible-playbook site.yml -vvvvv ?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bb05265f-8949-4913-ac5a-664b1b9cc02b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pixel fairy

unread,
May 5, 2018, 8:52:03 PM5/5/18
to Ansible Project
Yes, but without so much verbose.

turns out to be a known bug in pywinrm, fixed in current tree. installing from github fixed it.

if you have the same problem, wait till pywinrm-0.3.1 (or whatever version) is out, or

git clone https://github.com/diyan/pywinrm
cd pywinrm
pip install
--upgrade .

then just pip upgrade as usual when the fix is released.
Reply all
Reply to author
Forward
0 new messages