尝试使用 GNS3 练习 ansible 脚本,有一个名为“网络自动化”的内置 ansible 的 docker 实例。但是,它仍然使用 Python 2.7 作为解释器:
root@Network-Automation:~# ansible --version
ansible 2.7.11
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用“ansible-playbook --version -e 'ansible_python_interpreter=/usr/bin/python3'”命令来运行 Python 版本 3 的剧本,或者我可以在剧本中指定 var:
- name: Common package
hosts: all
gather_facts: no
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
- { role: python, tags: [ init, python, common, …Run Code Online (Sandbox Code Playgroud) 一个多月以来,我一直在运行以下命令:
ansible-playbook -vvvvi host_test rhel-tests.yml
Run Code Online (Sandbox Code Playgroud)
它通过 SSH 连接并在主机上成功运行测试,没有任何问题。但截至最近几天,我在运行时收到以下信息:
fatal: [10.2.16.2]: UNREACHABLE! => {
"changed": false,
"unreachable": true
}
MSG:
Failed to connect to the host via ssh: OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 35742
debug3: …Run Code Online (Sandbox Code Playgroud) 执行程序时出现以下错误。
它是一个解析上传文件的程序。
当用户尝试上传文档时出现错误
Error: module 'platform' has no attribute 'linux_distribution'
Path: tmp/resume_2020-08-28_10-09-05/Document.pdf
Traceback (most recent call last):
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 143, in <module>
libraries = load_library()
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/wand/api.py", line 132, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/adiagarwal/projects/BackEnd/admin_api.py", line 198, in post
im = page.to_image()
File "/home/adiagarwal/Python-3.8.0/resume_parser_env/lib/python3.8/site-packages/pdfplumber/page.py", line 255, in to_image
from .display import …Run Code Online (Sandbox Code Playgroud) ansible ×2
ubuntu ×2
ansible-2.x ×1
neo4j ×1
python ×1
python-3.8 ×1
python-3.x ×1
ssh ×1
tornado ×1