Как исправить "Недостижимый" при пинге окон с ansible через ssh? - PullRequest
0 голосов
/ 23 октября 2019

Я пытаюсь использовать Ansible с ssh для взаимодействия с машинами Windows

Я успешно установил OpenSSH на машину Windows, что означает, что я могу подключиться из Linux к Windows с:

 ssh username@ipAdresse

Я пытался использовать много версий ansible (2.6, 2.7.12, 2.7.14, 2.8.5 и 2.8.6), и я всегда проверяю, могу ли я пропинговать другой Linux-компьютер с этой строкой (это работает):

ansible linux -m ping

Есть мой файл hosts

[windows]
192.***.***.***

[linux]
192.***.***.***

[all:vars]
ansible_connection=ssh
ansible_user=root

[windows:vars]
ansible_ssh_pass=*******
remote_tmp=C:\Users\root\AppData\Local\Temp\
become_method=runas

есть ошибка с многословным:

[root@oel76-template ~]# ansible windows -m win_ping -vvv

ansible 2.8.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 08:19:52) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39.0.1)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
<192.***.***.***> ESTABLISH SSH CONNECTION FOR USER: root
<192.***.***.***> SSH: EXEC sshpass -d8 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/91df1ca379 192.168.46.99 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo C:/Users/root/AppData/Local/Temp/ansible-tmp-1571839448.66-279092717123794 `" && echo ansible-tmp-1571839448.66-279092717123794="` echo C:/Users/root/AppData/Local/Temp/ansible-tmp-1571839448.66-279092717123794 `" ) && sleep 0'"'"''
<192.***.***.***> (1, '', 'The system cannot find the path specified.\r\n')
<192.***.***.***> Failed to connect to the host via ssh: The system cannot find the path specified.

192.***.***.*** | UNREACHABLE! => {
"changed": false,
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo C:/Users/root/AppData/Local/Temp/ansible-tmp-1571839448.66-279092717123794 `\" && echo ansible-tmp-1571839448.66-279092717123794=\"` echo C:/Users/root/AppData/Local/Temp/ansible-tmp-1571839448.66-279092717123794 `\" ), exited with result 1",
    "unreachable": true
}

Я не знаю, кто яделаю неправильно, я также пытаюсь изменить remote_tmp в ansible.cfg, но не более того.

Фактическое значение для remote_tmp = C: / Users / root / AppData / Local / Temp

Есть идеи?

1 Ответ

0 голосов
/ 24 октября 2019

ОК решено, проблема была

ansible_ssh_pass=*****

правильный синтаксис:

ansible_password=*****
...