Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Create VM
- hosts: localhost
- gather_facts: no
- vars:
- vcenter_server: xxx.xx.xx.xx
- vcenter_user: admin@vsphere.local
- vcenter_pass: xxxxxx
- tasks:
- - set_fact:
- vm_name: "ansible_test"
- datacenter_name: "DC01"
- cluster_name: "Test Cluster"
- vm_folder: /Non-Production/Test Servers
- esxi_hostname: my_host
- memory: 1024
- cpu: 2
- - name: Crete new VM
- vmware_guest:
- hostname: "{{ vcenter_server }}"
- username: "{{ vcenter_user }}"
- password: "{{ vcenter_pass }}"
- validate_certs: no
- folder: "{{ vm_folder }}"
- name: "{{ vm_name }}"
- state: poweredon
- guest_id: centos64Guest
- esxi_hostname: "{{ esxi_hostname }}"
- datacenter: "{{ datacenter_name }}"
- disk:
- - size_gb: 40
- type: thin
- datastore: UXEM Datastore 5
- autoselect_datastore: yes
- hardware:
- memory_mb: "{{ memory }}"
- num_cpus: "{{ cpu }}"
- scsi: lsilogic
- wait_for_ip_address: yes
- delegate_to: localhost
- register: deploy_vm
- ...
- [root@DCOPANSIAP01 playbooks]# ansible-playbook vmware_create_vm.yml -vvv
- ansible-playbook 2.7.7
- config file = /etc/ansible/ansible.cfg
- configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
- ansible python module location = /usr/lib/python2.7/site-packages/ansible
- executable location = /usr/bin/ansible-playbook
- python version = 2.7.5 (default, Sep 12 2018, 05:31:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
- Using /etc/ansible/ansible.cfg as config file
- /etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
- /etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
- Parsed /etc/ansible/hosts inventory source with ini plugin
- PLAYBOOK: vmware_create_vm.yml *****************************************************************************************************************************************
- 1 plays in vmware_create_vm.yml
- PLAY [Reconfigure VM] **************************************************************************************************************************************************
- META: ran handlers
- TASK [set_fact] ********************************************************************************************************************************************************
- task path: /etc/ansible/playbooks/vmware_create_vm.yml:13
- ok: [localhost] => {
- "ansible_facts": {
- "cluster_name": "Test Cluster",
- "cpu": 2,
- "datacenter_name": "DC01",
- "esxi_hostname": "my_host",
- "memory": 1024,
- "vm_folder": "/Non-Production/Test Servers",
- "vm_name": "ansible_test"
- },
- "changed": false
- }
- TASK [Crete new VM] ****************************************************************************************************************************************************
- task path: /etc/ansible/playbooks/vmware_create_vm.yml:22
- <localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
- <localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
- <localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895 `" && echo ansible-tmp-1551202153.43-45324044914895="` echo /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895 `" ) && sleep 0'
- Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest.py
- <localhost> PUT /root/.ansible/tmp/ansible-local-113215A8Leqx/tmp_9MrJa TO /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895/AnsiballZ_vmware_guest.py
- <localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895/ /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895/AnsiballZ_vmware_guest.py && sleep 0'
- <localhost> EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1551202153.43-45324044914895/AnsiballZ_vmware_guest.py && sleep 0'
Add Comment
Please, Sign In to add comment