Look like you need to add become_user option there

Sent from my iPhone

> On 26 Apr 2021, at 18:21, rebecca acheampong <[email protected]> wrote:
> 
> I am using ansible to install a docker but I get this error. How can i solve 
> this please?
> Please help me, this installation has taken me a whole week
> 
> Control node is ubuntu server 20.04
> Target node is ubuntu desktop 18.04 on vmware esxi
> 
> this is my playbook: 
> ---
> - name: installing docker on ubuntu
>   hosts: localhost
>   remote_user: "{{ remote_user_name }}"
>   gather_facts: no
>   vars_files:
>      - var_docker.yml
>   vars:
>    remote_user_name: cyber01
>    apt_repo_data: "deb [arch=amd64]
>    https://download.docker.com/linux/ubuntu xenial stable"
>    apt_gpg_key: https://download.docker.com/linux/ubuntu/gpg
>   tasks:
>     - vmware_guest:
>         hostname: "{{ VMWARE_HOST }}"
>         username: "{{ VMWARE_USER }}"
>         password: "{{ VMWARE_PASSWORD }}"
>         validate_certs: no
>         folder: /ha-datacenter/vm/
>         name: my_vm_01
>     - name: adding docker gpg key
>       apt_key:
>         url: "{{ apt_gpg_key }}"
>         state: present
>     - name: add docker repository
>       apt_repository:
>          repo: "{{ apt_repo_data }}"
>         state: present
>     - name: installing docker-ce
>       apt:
>         name: docker-ce
>         state: present
>         update_cache: yes
>     - name: install python-pip
>       apt:
>         name: python-pip
>         state: present
>     - name: install docker-py
>       pip:
>         name: docker-py
>         state: present
> 
> run playbook: ansible-playbook -i hosts docker_contairner.yml
> 
> PLAY [installing docker on ubuntu] 
> *********************************************
> 
> TASK [vmware_guest] 
> ************************************************************
> ok: [my_vm_01]
> 
> TASK [adding docker gpg key] 
> ***************************************************
> fatal: [my_vm_01]: FAILED! => {"changed": false, "cmd": "/usr/bin/apt-key add 
> -", "msg": "Warning: apt-key output should not be parsed (stdout is not a 
> terminal)\nE: This command can only be used by root.", "rc": 1, "stderr": 
> "Warning: apt-key output should not be parsed (stdout is not a terminal)\nE: 
> This command can only be used by root.\n", "stderr_lines": ["Warning: apt-key 
> output should not be parsed (stdout is not a terminal)", "E: This command can 
> only be used by root."], "stdout": "", "stdout_lines": []}
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/eac60358-57e0-4f9f-ad03-377ec881f6e2n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E99A3916-3584-401F-874D-210A83FEE7C2%40gmail.com.

Reply via email to