I'm trying to deploy vms from template on esx with vmware_guest module and 
this work great, but I would like to do inside this playbook some 
modification on vm after deployment. My inventory file is being populated 
with the same playbook with hosts that are being deployed, but after that 
I'm doing some modification, problem is that this hosts are being skipped 
because ansible doesn't know for this hosts, setup module doesn't do the 
job. How would I convinced ansible to reread inventory file? 

Hear is last part of the playbook:

   - name: add to inventoryfile 
     lineinfile: 
       dest: /home/ansible/vmware/inventory 
       line: '{{ item.vm_name }}' 
     loop: '{{ vm }}' 
     delegate_to: localhost

   - setup:  

    - name: Read device information
     community.general.parted: device=/dev/sda unit=MiB 
     register: sda_info 
     when: inventory_hostname in groups.deploy 

   - name: Extend an existing partition to fill all available space 
     community.general.parted: 
       device: /dev/sda 
       number: "{{ sda_info.partitions | length }}" 
       part_end: "100%" 
       resize: true 
       state: present 
     when: inventory_hostname in groups.deploy 

   - name: pv resize 
     community.general.lvg: 
       vg: vg_root 
        pvs: /dev/sda2 
       pvresize: yes 
     when: inventory_hostname in groups.deploy 

   - name: fqdn 
     hostname: 
       name: "{{ ansible_fqdn }}" 
     when: inventory_hostname in groups.deploy


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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d5833332-ea28-447f-b252-09c10c1af7e0n%40googlegroups.com.

Reply via email to