无法使用 ansible playbook 安装 dnspython
failed to install dnspython with ansible playbook
团队,
我的剧本如下,我也尝试过 become: yes
但没有成功。如何解决这个问题?
- easy_install:
name: dnspython
state: present
#become: yes
- name: Validate DNS record lookup for {{ kubeapi_server }}
debug: msg="{{ lookup('dig', '{{ kubeapi_server }}' )}}"
vars:
variable: "{{ lookup('dig', '{{ kubeapi_server }}' )}}"
failed_when: not variable
输出:
16:18:07 TASK [team-deploy-validation : easy_install] *********************************
16:18:07 [1;30mtask path: /home/testuser/jenkins/workspace/nvdc/run_ansible_playbook/k8s/baremetal/roles/team-deploy-validation/tasks/main.yml:9[0m
16:18:07 Friday 11 October 2019 23:18:07 +0000 (0:00:00.029) 0:00:02.902 ********
16:18:07 [0;34mUsing module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/language/easy_install.py[0m
16:18:07 [0;34mPipelining is enabled.[0m
16:18:07 [0;34m<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: testuser[0m
16:18:07 [0;34m<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python && sleep 0'[0m
16:18:07 [0;31mThe full traceback is:[0m
16:18:07 [0;31mWARNING: The below traceback may *not* be related to the actual failure.[0m
16:18:07 [0;31m File "/teamtmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/basic.py", line 1974, in get_bin_path[0m
16:18:07 [0;31m bin_path = get_bin_path(arg, required, opt_dirs)[0m
16:18:07 [0;31m File "/tmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/common/process.py", line 41, in get_bin_path[0m
16:18:07 [0;31m raise ValueError('Failed to find required executable %s in paths: %s' % (arg, os.pathsep.join(paths)))[0m
16:18:07 [0;31m[0m
16:18:07 [0;31mfatal: [localhost]: FAILED! => {[0m
16:18:07 [0;31m "changed": false, [0m
16:18:07 [0;31m "invocation": {[0m
16:18:07 [0;31m "module_args": {[0m
16:18:07 [0;31m "executable": "easy_install", [0m
16:18:07 [0;31m "name": "dnspython", [0m
16:18:07 [0;31m "state": "present", [0m
16:18:07 [0;31m "virtualenv": null, [0m
16:18:07 [0;31m "virtualenv_command": "virtualenv", [0m
16:18:07 [0;31m "virtualenv_site_packages": false[0m
16:18:07 [0;31m }[0m
16:18:07 [0;31m }, [0m
16:18:07 [0;31m "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m
16:18:07 [0;31m}[0m
16:18:07
你的问题很简单。
16:18:07 [0;31m "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m
日志清楚地表明无法在您尝试安装 dnspython
的主机上找到 easy_install
。
您可以通过安装 python-setuptools
在您的远程主机上安装 easy_install
。
仅供参考,
easy_install
是一个 Python 模块,作为 Python setuptools 的一部分提供,因此安装 setuptools 会自动安装 easy_install。
我添加了示例任务(@Matthew 也建议),可以帮助您,
- apt:
name: python-setuptools
state: present
- easy_install:
name: dnspython
state: present
团队,
我的剧本如下,我也尝试过 become: yes
但没有成功。如何解决这个问题?
- easy_install:
name: dnspython
state: present
#become: yes
- name: Validate DNS record lookup for {{ kubeapi_server }}
debug: msg="{{ lookup('dig', '{{ kubeapi_server }}' )}}"
vars:
variable: "{{ lookup('dig', '{{ kubeapi_server }}' )}}"
failed_when: not variable
输出:
16:18:07 TASK [team-deploy-validation : easy_install] *********************************
16:18:07 [1;30mtask path: /home/testuser/jenkins/workspace/nvdc/run_ansible_playbook/k8s/baremetal/roles/team-deploy-validation/tasks/main.yml:9[0m
16:18:07 Friday 11 October 2019 23:18:07 +0000 (0:00:00.029) 0:00:02.902 ********
16:18:07 [0;34mUsing module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/language/easy_install.py[0m
16:18:07 [0;34mPipelining is enabled.[0m
16:18:07 [0;34m<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: testuser[0m
16:18:07 [0;34m<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python && sleep 0'[0m
16:18:07 [0;31mThe full traceback is:[0m
16:18:07 [0;31mWARNING: The below traceback may *not* be related to the actual failure.[0m
16:18:07 [0;31m File "/teamtmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/basic.py", line 1974, in get_bin_path[0m
16:18:07 [0;31m bin_path = get_bin_path(arg, required, opt_dirs)[0m
16:18:07 [0;31m File "/tmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/common/process.py", line 41, in get_bin_path[0m
16:18:07 [0;31m raise ValueError('Failed to find required executable %s in paths: %s' % (arg, os.pathsep.join(paths)))[0m
16:18:07 [0;31m[0m
16:18:07 [0;31mfatal: [localhost]: FAILED! => {[0m
16:18:07 [0;31m "changed": false, [0m
16:18:07 [0;31m "invocation": {[0m
16:18:07 [0;31m "module_args": {[0m
16:18:07 [0;31m "executable": "easy_install", [0m
16:18:07 [0;31m "name": "dnspython", [0m
16:18:07 [0;31m "state": "present", [0m
16:18:07 [0;31m "virtualenv": null, [0m
16:18:07 [0;31m "virtualenv_command": "virtualenv", [0m
16:18:07 [0;31m "virtualenv_site_packages": false[0m
16:18:07 [0;31m }[0m
16:18:07 [0;31m }, [0m
16:18:07 [0;31m "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m
16:18:07 [0;31m}[0m
16:18:07
你的问题很简单。
16:18:07 [0;31m "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m
日志清楚地表明无法在您尝试安装 dnspython
的主机上找到 easy_install
。
您可以通过安装 python-setuptools
在您的远程主机上安装 easy_install
。
仅供参考,
easy_install
是一个 Python 模块,作为 Python setuptools 的一部分提供,因此安装 setuptools 会自动安装 easy_install。
我添加了示例任务(@Matthew 也建议),可以帮助您,
- apt:
name: python-setuptools
state: present
- easy_install:
name: dnspython
state: present