標籤:ansible error ansible windows
Q1:安裝kerberos報錯
$ sudo pip install kerberosrunning build_extbuilding ‘kerberos‘ extensioncreating buildcreating build/temp.linux-x86_64-2.7creating build/temp.linux-x86_64-2.7/srcgcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/base64.c -o build/temp.linux-x86_64-2.7/src/base64.o sh: 1: krb5-config: not foundgcc: error: sh:: No such file or directorygcc: error: 1:: No such file or directorygcc: error: krb5-config:: No such file or directorygcc: error: not: No such file or directorygcc: error: found: No such file or directoryerror: command ‘gcc‘ failed with exit status 1----------------------------------------Command /usr/bin/python -c "import setuptools;__file__=‘/etc/ansible/scripts/build/kerberos/setup.py‘;exec(compile(open(__file__).read().replace(‘\r\n‘, ‘\n‘), __file__, ‘exec‘))" install --single-version-externally-managed --record /tmp/pip-Q3eBF1-record/install-record.txt failed with error code 1Storing complete log in /home/ansible/.pip/pip.log
A1:需要先安裝libkrb5開發包
$ sudo apt-get install libkrb5-dev
安裝後解決
Q:安裝.Net 3.0以上,升級powershell-3.0後ansible依舊報錯
$ ansible windows -m win_ping -vvvUsing /etc/ansible/ansible.cfg as config fileUsing module file /usr/local/lib/python2.7/dist-packages/ansible-2.2.0-py2.7.egg/ansible/modules/core/windows/win_ping.ps1<192.168.1.11> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 192.168.1.11192.168.1.11 | UNREACHABLE! => { "changed": false, "msg": "ssl: HTTPSConnectionPool(host=‘192.168.1.11‘, port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x23d8c10>, ‘Connection to 192.168.1.11 timed out. (connect timeout=30)‘))", "unreachable": true}
A:原因沒有配置winrm
必須將winrm的設定檔設定成下面配置,
> winrm set winrm/config/service
‘@{AllowUnencrypted="true"}‘
> winrm set winrm/config/service/auth
‘@{Basic="true"}‘
650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/89/0A/wKiom1gFy-bhI6y7AABQOm0lSnU082.png-wh_500x0-wm_3-wmp_4-s_3489884060.png" title="winrm_config.png" alt="wKiom1gFy-bhI6y7AABQOm0lSnU082.png-wh_50" />
Q:ansible控制Windows主機error1
$ ansible windows -m win_ping -vvvUsing /etc/ansible/ansible.cfg as config fileUsing module file /usr/local/lib/python2.7/dist-packages/ansible-2.2.0-py2.7.egg/ansible/modules/core/windows/win_ping.ps1<192.168.30.150> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 192.168.30.150192.168.30.150 | UNREACHABLE! => { "changed": false, "msg": "ssl: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed", "unreachable": true}
A:
將設定檔/etc/ansible/hosts連接埠5986改成5985,即可解決。
[windows:vars]ansible_ssh_port=5985
原因:
DefaultPorts
HTTP = 5985
HTTPS = 5986
上述錯誤是因為ssl選項是關著的
本文出自 “M層” 部落格,請務必保留此出處http://mengix.blog.51cto.com/7194660/1863015
ansible控制windows安裝及運行error與解決方案