1

I am getting error with Ansible user Escalation. I am struggling from last 2 days but no luck.

I had a look on the previous answers. I have provided both become:yes and become_user:username in my script. I there is any issue then please let me know.

My Ansible script:

---
- 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"'

But I am getting error "msg": "[Errno 13] Permission denied: '/etc/apt/sources.list.d/.skype-stable.list-Y2albf'"

Command to run script is ansible-playbook ./shell/couchdb.yaml -vvv --extra-vars "user=pankaj host=127.0.0.1 pass=Welcome01"

This is my local system ubuntu 16.04 and my user is in sudo group.

Complete logs are with -vvv option https://hastebin.com/efuwahowor.makefile

Thanks in advance....

Gerhard
  • 6,850
  • 8
  • 51
  • 81
Pankaj Cheema
  • 1,028
  • 2
  • 13
  • 26

0 Answers0