ansible - 在 easy_install 中被 ansible 提示输入 ssh 密码
问题描述
团队,我需要使用我的 macbook 抱怨需要 dnspython 的 dig 模块。所以我用easy_install安装它,但提示输入密码。如何使其无密码?
- 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
输出 1:带 -k 选项
ansible-playbook -i inventory.txt playbook.yaml -k -K
SSH password:
BECOME password[defaults to SSH password]:
输出 1:没有 -k -K 选项
ansible-playbook -i inventory.txt playbook.yaml
TASK [0_test : easy_install] ***************************
fatal: [target1]: FAILED! => {"changed": false, "msg": "error: can't create or remove files in install directory\n\nThe following error occurred while trying to add or remove files in the\ninstallation directory:\n\n [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-68421.pth'\n\nThe installation directory you specified (via --install-dir, --prefix, or\nthe distutils default setting) was:\n\n /Library/Python/2.7/site-packages/\n\nPerhaps your account does not have write access to this directory? If the\ninstallation directory is a system-owned directory, you may need to sign in\nas the administrator or \"root\" account. If you do not have administrative\naccess to this machine, you may wish to choose a different installation\ndirectory, preferably one that is listed in your PYTHONPATH environment\nvariable.\n\nFor information on other options, you may wish to consult the\ndocumentation at:\n\n https://pythonhosted.org/setuptools/easy_install.html\n\nPlease make the appropriate changes for your system and try again.\n\n"}
解决方案
可能的原因可能是: 1.您没有在主机清单中指定密码。2. 用户的 sudo 权限应该是 NOPASSWD: ALL 在主机的 /etc/sudoers 中。
推荐阅读
- android - 自定义适配器不适用于片段中的 RecyclerView
- python - 如何编写一个 select sum(col), count(other_col) form pandas_df
- node.js - Nodejs - 来自 OData $batch 的响应正文状态
- angular - Angular:推,然后删除一个项目
- android - CoordinatorLayout 内的 ViewPager 和 TabLayout 结果为 NoMatchingViewException
- hibernate - 我们的数据库有大约 2000 个表,我应该使用 ORM 框架吗?
- php - 通过 PHP 从给定时间减少小时数
- javascript - 发送消息时不和谐机器人出错
- php - 如何将 USER 表和 USERINFO 表记录一对一匹配?
- javascript - Jquery LOAD 作为 IFRAME 的替代方案或类似方案