ansible install vm on vcenter




https://docs.ansible.com/ansible/2.6/vmware/scenario_clone_template.html



vsca must be installed 192.168.45.148 from VMware-vCenter-Server-Appliance-5.5.0.20200-2183109_OVF10 (2) on vmware workstation 15

vsphere client 5.5

vcenter 5.5

DC must be added
Cluster must be added
folder under DC to be added

vsphere host must be added 192.168.45.143
template cent must be created from virtual machne centos-server-6.4-x86_64

deploy ovf template  centos-server-6.4-x86_64-OVF



vm.yml

---
- name: Create a VM from a template
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  - name: Clone the template
    vmware_guest:
      hostname: 192.168.45.148 ( vcenter)
      username: root
      password: vmware
      validate_certs: False
      name: testvm_2
      template: cent

      datacenter: dc
      folder: /dc/vm
      state: poweredon
      wait_for_ip_address: yes
~                                                                                   
~                                                                                   
~                                                                                   
~                                                                                   
"cc.yml" 18L, 395C

[root@localhost ~]# ansible-playbook --connection=local vm.yml

PLAY [Create a VM from a template] ****************************************************

TASK [Clone the template] *************************************************************
changed: [localhost]

PLAY RECAP ****************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0 

[root@localhost ~]#




Comments

Popular posts from this blog

ansible redhat cluster qorum qdevice

PE 3.9.0 on centos 6

gfs2 cluster