support ovirt4 as a built-in inventory source

see: https://github.com/ansible/ansible-tower/issues/6522
This commit is contained in:
Ryan Petrello
2017-09-22 15:16:15 -04:00
committed by Matthew Jones
parent 4510cd11db
commit 74f2509482
11 changed files with 394 additions and 3 deletions

View File

@@ -59,6 +59,7 @@ class V1Credential(object):
('gce', 'Google Compute Engine'),
('azure_rm', 'Microsoft Azure Resource Manager'),
('openstack', 'OpenStack'),
('ovirt4', 'oVirt4'),
('insights', 'Insights'),
]
FIELDS = {
@@ -1000,3 +1001,48 @@ def insights(cls):
},
},
)
@CredentialType.default
def ovirt4(cls):
return cls(
kind='cloud',
name='oVirt4',
managed_by_tower=True,
inputs={
'fields': [{
'id': 'host',
'label': 'Host (Authentication URL)',
'type': 'string',
'help_text': ('The host to authenticate with.')
}, {
'id': 'username',
'label': 'Username',
'type': 'string'
}, {
'id': 'password',
'label': 'Password',
'type': 'string',
'secret': True,
}, {
'id': 'ca_file',
'label': 'CA File',
'type': 'string',
'help_text': ('Absolute file path to the CA file to use (optional)')
}],
'required': ['host', 'username', 'password'],
},
injectors={
'file': {
'template': '\n'.join([
'[ovirt]',
'ovirt_url={{host}}',
'ovirt_username={{username}}',
'ovirt_password={{password}}',
'{% if ca_file %}ovirt_ca_file={{ca_file}}{% endif %}'])
},
'env': {
'OVIRT_INI_PATH': '{{tower.filename}}'
}
},
)