i building ansible playbook takes care of creating vms in vmware vcenter , later expected perform operations inside newly created vms. while creation of vms successful, there seems no way refresh dynamic vmware inventory mid-play.
i came across discussion talks amazon ec2 inventory , points usage of - meta: refresh_inventory
supposed that. however, approach not seem work vcenter inventories. can suggest me approach handle this?
i use ansible tower (free version).
update don't have vmware.ini file. playbook intend refresh inventory goes follows. 1 runs prior 1 creates vms. both these playbooks called in master playbook using include statements.
--- - name: check if vms , running hosts: localhost tasks: - name: initial pause until vm facts ip become available pause: minutes=2 # 1 contains names - include_vars: /var/lib/awx/projects/vms/vmnames.yml - name: using vsphere_guest module verify if vm available vsphere_guest: vcenter_hostname: <<hostname>> guest: "{{ item }}" validate_certs: no vmware_guest_facts: yes esxi: datacenter: <<dcname>> hostname: <<name>> with_items: "{{ allvms }}" register: vmfacts no_log: true **this try using meta refresh inventory option** - name: checking if wait_for works wait_for: host={{ hw_eth0.ipaddresses[1] }} state=started delay=60 timeout=60 connect_timeout=15 with_items: "{{ vmfacts.results }}" no_log: true
Comments
Post a Comment