I think that is how it is supposed to work...

On Fri, 19 Feb 2021 at 18:50, j..r.. <[email protected]> wrote:

> Thanks
>
> meta: refresh_inventory  doesn't work inside vmware_guest module, I have
> to do  separate tasks directive for the configuration of vm's after
> deployment  in the playbook
>
> On Thursday, February 18, 2021 at 8:50:38 PM UTC+1 [email protected]
> wrote:
>
>> Hi,
>>
>> Another way of doing...
>>
>> You can also change the inventory live with some modules
>>
>>
>> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html
>>
>>
>> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/group_by_module.html#ansible-collections-ansible-builtin-group-by-module
>>
>> Regards,
>>
>> JYL
>>
>>
>> Le 18/02/2021 à 19:45, j..r.. a écrit :
>>
>> 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
>> <https://groups.google.com/d/msgid/ansible-project/d5833332-ea28-447f-b252-09c10c1af7e0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> --
> 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/1d7ebe17-6b46-41fb-9033-0195023e3acen%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/1d7ebe17-6b46-41fb-9033-0195023e3acen%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwO87-LaW8WnJNsyP5HGRDasQckf3%3D_BhrGng85F7ci0nw%40mail.gmail.com.

Reply via email to