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
vmware_inventory: permit to group by custom field & customize skip_keys #20125
Conversation
9dcd8ce
to
6b76b70
Compare
This permits to create instances, affect some custom fields like EC2 tags and then retrieve groups from custom fields like EC2 inventory
807fef5
to
d64c797
Compare
@dav1x can you also review/test please? |
d64c797
to
d397227
Compare
I'm unable to get this working for some reason: https://www.dropbox.com/s/mjhfx7l95jfw88s/Screenshot%202017-01-11%2011.20.37.png?dl=0
Am I doing something incorrectly? I also added a VM tag to make sure that wasn't the problem. https://www.dropbox.com/s/vjyogztt37jahcp/Screenshot%202017-01-11%2011.25.52.png?dl=0 |
no just enable it make it works. What is your ESX version ? i suspect you are using tags instead of custom fields |
vCenter via VCSA 6.5 Build - 4602587 Look at the screenshots in the previous. I'm using both custom attributes and tags. I tried both.
|
@dav1x you don't have vmware_tag_components_openshift group after a full load with refresh cache ? |
I do not. I don't see either group. |
@dav1x if you do ./vmware_inventory.py --debug --host host do you see "customvalue" field inside object root printed to screen ? |
if it's not the case can you send me the full object of one or you host (masking sensible datas) permitting to understand vmware 6.5 API, maybe something has changed (note: just keep 2 level of variables, more is not needed) |
No nothing. https://gist.github.com/dav1x/ed0c3ee4b84b2316162ff2002ed6bd2e |
can you set max_object_level=2 instead of max_object_level=1 ? Maybe it's related to recursion, it seem you have fields but they are empty, maybe because of that (and if it's that i will add a notice in the docs) |
@nerzhul nice! That fixed it! "'vmware_tag_'openshift_app": { |
Verify if customfield is a str before processing custom fields for a host
d397227
to
ed278fc
Compare
@dav1x thanks for your time and tests, i added a documentation notice to complete this PR, now it's ready to be shipped :) |
ISSUE TYPE
COMPONENT NAME
contrib/vmware_inventory.py
ANSIBLE VERSION
SUMMARY
This permits to create instances, affect some custom fields like EC2 tags and then retrieve groups from custom fields like EC2 inventory
Example: i have custom field components set to icinga2,grafana on host vmwaretest01 and vmwaretest02
inventory output is:
Also permit to customize skip_keys value to enhance ourselves the inventory performance. Add resourceconfig to default skip_keys as it doesn't have interesting values for grouping in most cases