mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 13:55:04 -02:30
Fixes https://trello.com/c/8KGzMa75 - Updates to VMware inventory script to include additional host variables, groups and ansible_ssh_host.
This commit is contained in:
@@ -956,7 +956,7 @@ class RunInventoryUpdate(BaseTask):
|
||||
ec2_opts['cache_path'] = cache_path
|
||||
ec2_opts.setdefault('cache_max_age', '300')
|
||||
for k,v in ec2_opts.items():
|
||||
cp.set(section, k, str(v))
|
||||
cp.set(section, k, unicode(v))
|
||||
# Build pyrax creds INI for rax inventory script.
|
||||
elif inventory_update.source == 'rax':
|
||||
section = 'rackspace_cloud'
|
||||
@@ -966,6 +966,15 @@ class RunInventoryUpdate(BaseTask):
|
||||
cp.set(section, 'username', credential.username)
|
||||
cp.set(section, 'api_key', decrypt_field(credential,
|
||||
'password'))
|
||||
# Allow custom options to vmware inventory script.
|
||||
elif inventory_update.source == 'vmware':
|
||||
section = 'defaults'
|
||||
cp.add_section(section)
|
||||
vmware_opts = dict(inventory_update.source_vars_dict.items())
|
||||
vmware_opts.setdefault('guests_only', 'True')
|
||||
for k,v in vmware_opts.items():
|
||||
cp.set(section, k, unicode(v))
|
||||
|
||||
# Return INI content.
|
||||
if cp.sections():
|
||||
f = cStringIO.StringIO()
|
||||
@@ -1026,6 +1035,7 @@ class RunInventoryUpdate(BaseTask):
|
||||
# complain about not being able to determine its version number.
|
||||
env['PBR_VERSION'] = '0.5.21'
|
||||
elif inventory_update.source == 'vmware':
|
||||
env['VMWARE_INI'] = kwargs.get('private_data_file', '')
|
||||
env['VMWARE_HOST'] = passwords.get('source_host', '')
|
||||
env['VMWARE_USER'] = passwords.get('source_username', '')
|
||||
env['VMWARE_PASSWORD'] = passwords.get('source_password', '')
|
||||
|
||||
Reference in New Issue
Block a user