powerdoff multiple vms with state: poweredoff

[root@localhost ~]# cat multiple.yml
---
- hosts: all
  gather_facts: false
  connection: local
  vars_prompt:
    - name: "vsphere_password"
      prompt: "vSphere Password"
    - name: "notes"
      prompt: "VM notes"
      private: no
      default: "Deployed with ansible"
  tasks:
  # get date
  - set_fact: creationdate="{{lookup('pipe','date "+%Y/%m/%d %H:%M"')}}"
  # Create a VM from a template
  - name: create the VM
    vmware_guest:
      hostname: 192.168.0.103
      username: root
      password: vmware
      validate_certs: no
      esxi_hostname: 192.168.0.108
      datacenter: dc
      folder: /dc/vm
      name: '{{ inventory_hostname }}'
      state: poweredoff
      guest_id: rhel6Guest
      annotation: "{{ notes }} - {{ creationdate }}"
      disk:
      - size_gb: 10
        type: thin
        datastore: datastore1
      hardware:
        memory_mb: 256
        num_cpus: 1
        scsi: paravirtual
        hostname: '{{ inventory_hostname }}'
      template: temper
      wait_for_ip_address: True
[root@localhost ~]#

[root@localhost ~]# ansible-playbook -i multiple multiple.yml
vSphere Password: 
VM notes [Deployed with ansible]: 

PLAY [all] *******************************************************************************************************************************************

TASK [set_fact] **************************************************************************************************************************************
ok: [ans-web01]
ok: [ans-web02]
ok: [ans-web03]
ok: [ans-web05]
ok: [ans-web04]

TASK [create the VM] *********************************************************************************************************************************
changed: [ans-web03]
changed: [ans-web01]
changed: [ans-web02]
changed: [ans-web05]
changed: [ans-web04]

PLAY RECAP *******************************************************************************************************************************************
ans-web01                  : ok=2    changed=1    unreachable=0    failed=0   
ans-web02                  : ok=2    changed=1    unreachable=0    failed=0   
ans-web03                  : ok=2    changed=1    unreachable=0    failed=0   
ans-web04                  : ok=2    changed=1    unreachable=0    failed=0   
ans-web05                  : ok=2    changed=1    unreachable=0    failed=0   

https://docs.google.com/document/d/e/2PACX-1vRoqlbSzcwJ9gXsVbzAH13pcBC8Abrj3Mk0wQVCP7p1aTdJQHSNCn4JyFJMZq1CU4K1uuF_q-Hy98Nh/pub

Comments