use*_*618 3 windows winrm ansible
当我尝试通过 WinRM 模块连接到我的 Windows 主机时,我在 Ansible 中收到“连接被拒绝”的错误消息。
\n\nansible目录结构如下:
\n\n命令:
\n\nuser@ansible:~/git/ansible-test$ ansible-playbook test.yml -i inventories/hosts \n\nPLAY [install vm] ***************************************************************************************************************************************************************************\n\nTASK [Gathering Facts] ***********************************************************************************************************************************************************************\nfatal: [10.10.10.10]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host=\'10.10.10.10\', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(\'<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6298184d50>: Failed to establish a new connection: [Errno 111] Connection refused\',))", "unreachable": true}\n to retry, use: --limit @/home/user/git/ansible-test/test.retry\n\nPLAY RECAP ***********************************************************************************************************************************************************************************\n10.10.10.10 : ok=0 changed=0 unreachable=1 failed=0 \nRun Code Online (Sandbox Code Playgroud)\n\nansible-test 直接层次结构:
\n\nansible-test$ tree\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 group_vars\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 all\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 inventories\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 hosts\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 test.yml\n\n2 directories, 3 files\nRun Code Online (Sandbox Code Playgroud)\n\n测试.yaml:
\n\n- name: test\n hosts: vm\n tasks:\n - name: get ipconfig information\n raw: ipconfg\n register: ipconfig_out\n - name: print stdout\n debug: var=ipconfig_out.stdout_lines\nRun Code Online (Sandbox Code Playgroud)\n\n库存/主机
\n\n[vm]\n10.10.10.10\nRun Code Online (Sandbox Code Playgroud)\n\n组变量/全部
\n\nansible_connection: winrm\nansible_user: Administrator\nansible_password: password\nRun Code Online (Sandbox Code Playgroud)\n\n但是如果我通过 WinRM 从其他 Windows 主机连接到目标 10.10.10.10:
\n\n Set-Item wsman:\\localhost\\Client\\TrustedHosts -value 10.10.10.10\n Enter-PSSession -ComputerName 10.10.10.10 -Credential (Get-Credential -UserName Administrator)\nRun Code Online (Sandbox Code Playgroud)\n\n一切都好!
\n\n我在 Ansible 中做错了什么?
\n\nPS\n目标主机是 Windows Server 2012
\n我没有配置 WinRM。
使固定:
ansible_winrm_server_cert_validation: ignore到我的 group_vars 文件中。| 归档时间: |
|
| 查看次数: |
24096 次 |
| 最近记录: |