On Mon, Apr 26, 2021 at 7:07 AM rebecca acheampong <[email protected]> wrote: > > > I wish i could separate them as you have told me but i am very new to ansible > and I am using it for my final project. I dont know how to do that. I changed > the host to the target node's name. I think you are right because the > localhost does the installation of the docker on the control node. But I do > not know what to do.
Here is a sample ansible playbook; don't know who wrote it. Take a look at it. Ask questions. Once you understand it, what you are trying to do should make sense. https://www.ansible.com/blog/getting-started-writing-your-first-playbook > On Monday, April 26, 2021 at 1:47:06 PM UTC+3 [email protected] wrote: >> >> You're using localhost as the target, which is OK for the vmware >> module (as that is an API based one), but then you also target >> localhost for the docker stuff. >> Split your deployment into separate playbook and make sure you're >> targeting the correct host. >> This may involve add_host etc. >> >> On Mon, 26 Apr 2021 at 12: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. >> >> >> >> -- >> Dick Visser >> Trust & Identity Service Operations Manager >> GÉANT > > -- > 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/ebd3bf51-8f39-40b3-b8bb-276bcaefa594n%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/CAHEKYV7EUpgu2%2B_3w9uamJ1voe5QWm0PJxsRC78SJw_nOk29Kw%40mail.gmail.com.
