Saya mengalami beberapa masalah on dan off saat menggunakan host windows di buku pedoman Ansible saya. Saya menjalankan Ansible 2.3 dengan pywinrm 0.2.2 diinstal. Saya menggunakan otentikasi dasar dengan pengguna Administrator lokal.
Terkadang saya menerima masalah ini saat menjalankan tugas:
[WARNING]: FATAL ERROR DURING FILE TRANSFER: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py", line 267, in _winrm_exec
self._winrm_send_input(self.protocol, self.shell_id, command_id, data, eof=is_last)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py", line 248, in _winrm_send_input
protocol.send_message(xmltodict.unparse(rq))
File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 207, in send_message
return self.transport.send_message(message)
File "/usr/local/lib/python2.7/dist-packages/winrm/transport.py", line 191, in send_message
raise WinRMTransportError('http', error_message) WinRMTransportError: (u'http', u'Bad HTTP response returned from server. Code 500')
Di lain waktu, ketika saya mencoba menjalankan win_shell/win_command/raw module
dan with_items
pada sekelompok host windows sepertinya gagal pada file sementara yang dibuat oleh Ansible.
Tugas yang saya coba jalankan adalah:
- name: Check services up
win_command: 'sc queryex {{ item }} | Findstr RUNNING'
with_items: '{{ component_services }}'
register: command_result
ignore_errors: yes
Dan kesalahan yang mungkin saya dapatkan adalah:
changed: [172.16.104.169] => (item=Dnscache)
failed: [172.16.104.176] (item=Dnscache) => {"failed": true, "item": "Dnscache",
"module_stderr": "Exception calling \"Run\" with \"1\" argument(s): \"Exception calling \"Invoke\" with \r\n\"0\"
argument(s): \"The running command stopped because
the preference variable \r\n\"ErrorActionPreference\"
or common parameter is set to
Stop: (0) : cannot open \r\nC:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\RESB3FF.tmp
for writing\r\n(1) :
using System;\r\n\"\"\r\nAt line:45 char:1\r\n+
$output = $entrypoint.Run($payload)\r\n+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordE \r\nxception\r\n+
FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n",
"module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
changed: [172.16.104.141] => (item=Dnscache)
changed: [172.16.104.168] => (item=Dnscache)
changed: [172.16.104.145] => (item=Dnscache)
Kedua masalah ini benar-benar acak dan bahkan mungkin tidak muncul sama sekali dalam urutan proses yang berbeda.
Ada bantuan?