介绍
在离线环境中运行Ansible的可能性更大。
其中,让我们从Ansible操作Windows!在大多数情况下,有必要安装pywinrm。
这次,我将描述如何在离线环境中安装pywinrm。
配置信息
<表格>
tr>
header>
<身体>
tr>
tr>
tr>
tbody>
table>
如何安装pywinrm
要安装pywinrm,请安装并安装pywinrm格式。
whl文件安装命令为
由于在常规RHEL或CentOS中未安装pip,因此先安装pip。
点介绍
pip在此站点上以tar.gz格式分发。
这次我将下载10.0.1。
获取
后,执行以下命令。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # pipのtar.gzファイルが存在しているパスにて実行 [root@localhost ~]# easy_install pip-10.0.1.tar.gz Processing pip-10.0.1.tar.gz Writing /tmp/easy_install-fDqaZi/pip-10.0.1/setup.cfg Running pip-10.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fDqaZi/pip-10.0.1/egg-dist-tmp-Pw9xSG /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.mailmap' warning: no previously-included files found matching '.travis.yml' warning: no previously-included files found matching '.landscape.yml' warning: no previously-included files found matching 'src/pip/_vendor/Makefile' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files found matching '*-requirements.txt' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'src/pip/_vendor/six' warning: no previously-included files matching '*.pyi' found under directory 'src/pip/_vendor' no previously-included directories found matching '.github' no previously-included directories found matching '.travis' no previously-included directories found matching 'docs/build' no previously-included directories found matching 'news' no previously-included directories found matching 'contrib' no previously-included directories found matching 'tasks' no previously-included directories found matching 'tests' Adding pip 10.0.1 to easy-install.pth file Installing pip script to /usr/bin Installing pip2.7 script to /usr/bin Installing pip2 script to /usr/bin Installed /usr/lib/python2.7/site-packages/pip-10.0.1-py2.7.egg Processing dependencies for pip==10.0.1 Finished processing dependencies for pip==10.0.1 [root@localhost ~]# pip --version pip 10.0.1 from /usr/lib/python2.7/site-packages/pip-10.0.1-py2.7.egg/pip (python 2.7) [root@localhost ~]# |
pywinrm依赖文件下载
安装pywinrm。
安装pywinrm时,必须预先安装以下文件。
- 轮
- xmltodict
- ntlm_auth
- 要求
- requests_ntlm
按照说明进行安装。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | [root@localhost ~]# pip install wheel-0.29.0-py2.py3-none-any.whl Processing ./wheel-0.29.0-py2.py3-none-any.whl Installing collected packages: wheel Successfully installed wheel-0.29.0 [root@localhost ~]# pip install xmltodict-0.11.0-py2.py3-none-any.whl Processing ./xmltodict-0.11.0-py2.py3-none-any.whl Installing collected packages: xmltodict Successfully installed xmltodict-0.11.0 [root@localhost ~]# pip install ntlm_auth-1.2.0-py2.py3-none-any.whl Processing ./ntlm_auth-1.2.0-py2.py3-none-any.whl Installing collected packages: ntlm-auth Successfully installed ntlm-auth-1.2.0 [root@localhost ~]# pip install requests-2.9.1-py2.py3-none-any.whl Processing ./requests-2.9.1-py2.py3-none-any.whl Installing collected packages: requests Successfully installed requests-2.9.1 [root@localhost ~]# pip install requests_ntlm-1.1.0-py2.py3-none-any.whl Processing ./requests_ntlm-1.1.0-py2.py3-none-any.whl Requirement already satisfied: ntlm-auth>=1.0.2 in /usr/lib/python2.7/site-packages (from requests-ntlm==1.1.0) (1.2.0) Requirement already satisfied: cryptography>=1.3 in /usr/lib64/python2.7/site-packages (from requests-ntlm==1.1.0) (1.7.2) Requirement already satisfied: requests>=2.0.0 in /usr/lib/python2.7/site-packages (from requests-ntlm==1.1.0) (2.9.1) Requirement already satisfied: idna>=2.0 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (2.4) Requirement already satisfied: pyasn1>=0.1.8 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (0.1.9) Requirement already satisfied: six>=1.4.1 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (1.9.0) Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (0.9.8) Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (1.0.4) Requirement already satisfied: ipaddress in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (1.0.16) Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python2.7/site-packages (from cryptography>=1.3->requests-ntlm==1.1.0) (1.6.0) Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.3->requests-ntlm==1.1.0) (2.14) Installing collected packages: requests-ntlm Successfully installed requests-ntlm-1.1.0 [root@localhost ~]# |
pywinrm安装
最后,安装pywinrm。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@localhost ~]# pip install pywinrm-0.2.2-py2.py3-none-any.whl Processing ./pywinrm-0.2.2-py2.py3-none-any.whl Requirement already satisfied: xmltodict in /usr/lib/python2.7/site-packages (from pywinrm==0.2.2) (0.11.0) Requirement already satisfied: requests>=2.9.1 in /usr/lib/python2.7/site-packages (from pywinrm==0.2.2) (2.9.1) Requirement already satisfied: requests-ntlm>=0.3.0 in /usr/lib/python2.7/site-packages (from pywinrm==0.2.2) (1.1.0) Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from pywinrm==0.2.2) (1.9.0) Requirement already satisfied: ntlm-auth>=1.0.2 in /usr/lib/python2.7/site-packages (from requests-ntlm>=0.3.0->pywinrm==0.2.2) (1.2.0) Requirement already satisfied: cryptography>=1.3 in /usr/lib64/python2.7/site-packages (from requests-ntlm>=0.3.0->pywinrm==0.2.2) (1.7.2) Requirement already satisfied: idna>=2.0 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (2.4) Requirement already satisfied: pyasn1>=0.1.8 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (0.1.9) Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (0.9.8) Requirement already satisfied: enum34 in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (1.0.4) Requirement already satisfied: ipaddress in /usr/lib/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (1.0.16) Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python2.7/site-packages (from cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (1.6.0) Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.3->requests-ntlm>=0.3.0->pywinrm==0.2.2) (2.14) Installing collected packages: pywinrm Successfully installed pywinrm-0.2.2 [root@localhost ~]# |
这样就完成了安装。
Windows模块也将可用。
在联机环境中,您可以使用单个命令来执行此操作,但是由于将软件包放在了一起,因此脱机安装非常困难。