Ansible WinRM Работает только с 2 хостами из 5 в группе - PullRequest
0 голосов
/ 19 декабря 2018

У меня есть группа хостов Windows

[WindowsHostsProduction]

WinServer2016_a  ansible_host=x.x.x.36

WinServer2016_g   ansible_host=x.x.x.44

WinServer2016_p ansible_host=x.x.x.44

WinServer2016_z   ansible_host=x.x.x.44

WinServer2016_e  ansible_host=x.x.x.44


[WindowsHostsProduction:vars]

ansible_user =xxx

ansible_password =xxx

ansible_port = 5986

ansible_connection = winrm

ansible_winrm_server_cert_validation = ignore

ansible_winrm_transport=basic

Затем я использую playbook примерно так:

---

- name: Install Cygwin on win hosts
  hosts: WindowsHostsProduction
  gather_facts: false

  tasks:

    - name: Check installation of cygwin
      win_stat:
        path: C:\cygwin
      register: stat_file

    - name: create infrastructure
      win_shell: mkdir C:\cygwinx64
      when: stat_file.stat.exists == False

    - name: copy exe files
      win_copy: src=/etc/ansible/psscenario/InCggWin.ps1 dest=C:\cygwinx64\InCggWin.ps1
      when: stat_file.stat.exists == False

    - name: install cygwin
      win_shell: C:\cygwinx64\InCggWin.ps1
      when: stat_file.stat.exists == False

Мой скрипт работаеттолько на 2 серверах из 5, но если я включаю собирать факты, у меня есть тестовое соединение на всех 5 хороших.

эта строка, я думаю, является причиной Невозможно попытаться соединиться только на 2 первых серверах

TASK [create infrastructure] ******************************************************************************************************************************************************************
task path: /etc/ansible/scripts/AnCygInst.yml:14
skipping: [WinServer2016_a] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_shell.ps1
<x.x.x.44> ESTABLISH WINRM CONNECTION FOR USER: AnsibleManager on PORT 5986 TO x.x.x.44
checking if winrm_host x.x.x.44 is an IPv6 address
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_shell.ps1
<x.x.x.44> ESTABLISH WINRM CONNECTION FOR USER: AnsibleManager on PORT 5986 TO x.x.x.44
checking if winrm_host x.x.x.44 is an IPv6 address
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_shell.ps1
<x.x.x.44> ESTABLISH WINRM CONNECTION FOR USER: xxx on PORT 5986 TO x.x.x.44
checking if winrm_host x.x.x.44 is an IPv6 address
EXEC (via pipeline wrapper)
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_shell.ps1
<x.x.x.44> ESTABLISH WINRM CONNECTION FOR USER: xxx on PORT 5986 TO x.x.x.44

но: >>>>>>>>>>>>>>>>>>>>>>>>>>>>

ansible WindowsHostsProduction -i hosts -m win_ping
WinServer2016_z | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
WinServer2016_g | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
WinServer2016_p | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
WinServer2016_e | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
WinServer2016_a | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Помощь поэто, но я думаю, что все говорит Ansible не для Windows :)

...