Ansible用户升级出现错误。最近两天我都在挣扎,但是没有运气。
我看了以前的答案。我在脚本中同时提供了become:yes
和become_user:username
。我有任何问题,请告诉我。
我的Ansible脚本:
---
- hosts: "{{ host }}"
remote_user: "{{ user }}"
vars:
ansible_become_pass: "{{ pass }}"
become: yes
become_user: "{{ user }}"
tasks:
- debug :
msg: "{{ user }}"
- name: Print user name
command: echo "{{ansible_env.HOME}}"
register: test
- debug :
msg: "{{test}}"
- name: Add couchdb repository
apt_repository:
repo: "deb https://apache.bintray.com/couchdb-deb xenial main"
state: present
- name: Add couchdb key
apt_key:
url: https://couchdb.apache.org/repo/bintray-pubkey.asc
state: present
- name: Install couchdb
apt:
name: couchdb
state: present
- name: Set Couchdb Username and password
command: curl -s -X PUT http://localhost:5984/_node/couchdb@127.0.0.1/_config/admins/rob -d '"123456"'
但是我遇到错误"msg": "[Errno 13] Permission denied: '/etc/apt/sources.list.d/.skype-stable.list-Y2albf'"
运行脚本的命令是ansible-playbook ./shell/couchdb.yaml -vvv --extra-vars "user=pankaj host=127.0.0.1 pass=Welcome01"
这是我的本地系统ubuntu 16.04,我的用户位于sudo组中。
完整日志带有-vvv选项 https://hastebin.com/efuwahowor.makefile
提前谢谢。...