ansible控制windows安装及运行error与解决方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible控制windows安装及运行error与解决方法相关的知识,希望对你有一定的参考价值。
Q1:安装kerberos报错
$ sudo pip install kerberos running build_ext building ‘kerberos‘ extension creating build creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/src gcc -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 found gcc: error: sh:: No such file or directory gcc: error: 1:: No such file or directory gcc: error: krb5-config:: No such file or directory gcc: error: not: No such file or directory gcc: error: found: No such file or directory error: 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 1 Storing 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 -vvv Using /etc/ansible/ansible.cfg as config file Using 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.11 192.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"}‘
Q:ansible控制Windows主机error1
$ ansible windows -m win_ping -vvv Using /etc/ansible/ansible.cfg as config file Using 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.150 192.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与解决方法的主要内容,如果未能解决你的问题,请参考以下文章