Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: refresh_inventory does not work for VMware dynamic inventory #17409

Closed
gischethans opened this issue Sep 6, 2016 · 1 comment
Closed

Comments

@gischethans
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

meta

ANSIBLE VERSION
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION
OS / ENVIRONMENT

Ubuntu 14.04.5 LTS with Ansible Tower 3.0.0

SUMMARY

According to the docs for the meta module, using
- meta: refresh_inventory

forces the reload of the inventory, which in the case of dynamic inventory scripts means they will be re-executed. This is mainly useful when additional hosts are created and users wish to use them instead of using the add_host module.

However, in the case of VMware dynamic inventories, this is not happening. In fact, nothing gets logged in the console making it hard to comprehend what's wrong.

STEPS TO REPRODUCE

---
- name: Check if VMs are up and running
  hosts: localhost

  tasks:
    - name: Initial Pause until some VM facts like the IP become available
      pause: minutes=2

  # This one just contains the names
- include_vars: /var/lib/awx/projects/vms/vmnames.yml

- name: Using vsphere_guest module to verify if VM is 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

- meta: refresh_inventory

- 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
EXPECTED RESULTS

I expect the dynamic inventory to refresh and show me the available VMs under hosts (this one after syncing manually).
pass

ACTUAL RESULTS

fail

@jctanner
Copy link
Contributor

jctanner commented Sep 6, 2016

@gischethans Tower's inventory system is a bit different than the standard in-memory inventory object of OSS ansible. Please reach out to our Tower support team for further assistance/recommendations.

@jctanner jctanner closed this as completed Sep 6, 2016
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants