--- - name: Configurar maquina virtual hosts: localhost connection: local vars_prompt: - name: HOSTNAME prompt: "Hostname" private: no - name: IP prompt: "IP Address" private: no - name: NETMASK prompt: "Netmask" private: no - name: GATEWAY prompt: "Gateway" private: no - name: VLAN prompt: "VLAN" private: no tasks: - name: Apagar maquina virtual vmware_guest: hostname: "192.0.0.1" username: "useradmin@vsphere.local" password: "CONTRASENYA" validate_certs: no name: "{{ HOSTNAME }}" state: poweredoff delegate_to: localhost when: 'VCENTER == "QADES"' - name: Se realiza la configuración vmware_guest: hostname: "192.0.0.1" username: "useradmin@vsphere.local" password: "CONTRASENYA" validate_certs: no name: "{{ HOSTNAME }}" datacenter: "SITE 1" networks: - name: "{{ VLAN }}" ip: "{{ IP }}" netmask: "{{ NETMASK }}" gateway: "{{ GATEWAY }}" start_connected: yes customization: hostname: "{{ HOSTNAME }}" existing_vm: true wait_for_customization: yes delegate_to: localhost