Here is the error message when I use localhost in the playbook. *ERROR MESSAGE* Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: create_appVCLOUD.yml ************************************************* 1 plays in create_appVCLOUD.yml PLAY [localhost] *************************************************************** TASK [vsphere_guest] *********************************************************** task path: /etc/ansible/create_appVCLOUD.yml:6 Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/cloud/vmware/vsphere_guest.py <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162 `" && echo ansible-tmp-1484165467.41-270348352264162="` echo $HOME/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162 `" ) && sleep 0' <127.0.0.1> PUT /tmp/tmp_bDCQ3 TO /root/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162/vsphere_guest.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162/ /root/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162/vsphere_guest.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162/vsphere_guest.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1484165467.41-270348352264162/" > /dev/null 2>&1 && sleep 0' An exception occurred during task execution. The full traceback is: Traceback (most recent call last): File "/tmp/ansible_vw2rQu/ansible_module_vsphere_guest.py", line 1909, in <module> main() File "/tmp/ansible_vw2rQu/ansible_module_vsphere_guest.py", line 1776, in main viserver.connect(vcenter_hostname, username, password) File "build/bdist.linux-x86_64/egg/pysphere/vi_server.py", line 101, in connect File "build/bdist.linux-x86_64/egg/pysphere/resources/VimService_services.py", line 2170, in RetrieveServiceContent File "build/bdist.linux-x86_64/egg/pysphere/ZSI/client.py", line 295, in Send File "/usr/lib64/python2.7/httplib.py", line 1227, in connect HTTPConnection.connect(self) File "/usr/lib64/python2.7/httplib.py", line 807, in connect self.timeout, self.source_address) File "/usr/lib64/python2.7/socket.py", line 571, in create_connection raise err socket.error: [Errno 111] Connection refused fatal: [localhost]: FAILED! => { "changed": false, "failed": true, "invocation": { "module_name": "vsphere_guest" }, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_vw2rQu/ansible_module_vsphere_guest.py\", line 1909, in <module>\n main()\n File \"/tmp/ansible_vw2rQu/ansible_module_vsphere_guest.py\", line 1776, in main\n viserver.connect(vcenter_hostname, username, password)\n File \"build/bdist.linux-x86_64/egg/pysphere/vi_server.py\", line 101, in connect\n File \"build/bdist.linux-x86_64/egg/pysphere/resources/VimService_services.py\", line 2170, in RetrieveServiceContent\n File \"build/bdist.linux-x86_64/egg/pysphere/ZSI/client.py\", line 295, in Send\n File \"/usr/lib64/python2.7/httplib.py\", line 1227, in connect\n HTTPConnection.connect(self)\n File \"/usr/lib64/python2.7/httplib.py\", line 807, in connect\n self.timeout, self.source_address)\n File \"/usr/lib64/python2.7/socket.py\", line 571, in create_connection\n raise err\nsocket.error: [Errno 111] Connection refused\n", "module_stdout": "", "msg": "MODULE FAILURE" } to retry, use: --limit @/etc/ansible/create_appVCLOUD.retry PLAY RECAP ********************************************************************* localhost : ok=0 changed=0 unreachable=0 failed=1 On Monday, January 9, 2017 at 7:17:46 PM UTC-6, Robert Williams wrote: > > Hello, I am new to Ansible and am having trouble spinning up a vm from a > template using Ansible. I am unsure on what to put for "hosts" in my > playbook. Should this be the vcenter hostname , vsphere hostname or > something else? Any help is appreciated. Thanks in advance. > > > *PlayBook* > --- > - hosts: vmcreate > gather_facts: false > connection: local > tasks: > - vsphere_guest: > vcenter_hostname: vcloud.example.com > username: username > password: password > guest: test01 > from_template: yes > template_src: 20.10_LAB > cluster: ABC - vCloud - Lab > resource_pool: "/ABC" > esxi: > datacenter: 'vCloud - Charleston, SC' > hostname: vCloud - Lab > > *Error Message* > ansible-playbook create_appVCLOUD.yml > > [WARNING]: provided hosts list is empty, only localhost is available > > PLAY RECAP > ********************************************************************* > > Thanks, > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b1593444-307e-45a4-903d-67f33e39e4bc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.