团队, 我需要使用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
output1:带有-k选项
ansible-playbook -i inventory.txt playbook.yaml -k -K
SSH password:
BECOME password[defaults to SSH password]:
output1:不带-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"}
答案 0 :(得分:0)
可能的原因可能是: 1.您没有在主机清单中指定密码。 2.用户的sudo权限应为NOPASSWD:主机的/ etc / sudoers中的ALL。