Add OpenStack Director provider (#35043)
Adds the ability to create an OpenStack Director provider in ManageIQ.
This commit is contained in:
parent
669a86174f
commit
b8e8fb48a8
1 changed files with 75 additions and 7 deletions
|
@ -37,7 +37,7 @@ options:
|
|||
type:
|
||||
description: The provider's type.
|
||||
required: true
|
||||
choices: ['Openshift', 'Amazon', 'oVirt', 'VMware', 'Azure']
|
||||
choices: ['Openshift', 'Amazon', 'oVirt', 'VMware', 'Azure', 'Director']
|
||||
zone:
|
||||
description: The ManageIQ zone name that will manage the provider.
|
||||
required: false
|
||||
|
@ -66,6 +66,12 @@ options:
|
|||
default: null
|
||||
description: Tenant ID. defaults to None.
|
||||
version_added: "2.5"
|
||||
api_version:
|
||||
required: false
|
||||
default: null
|
||||
description: The OpenStack Keystone API version. defaults to None.
|
||||
choices: ['v2', 'v3']
|
||||
version_added: "2.5"
|
||||
|
||||
provider:
|
||||
required: false
|
||||
|
@ -97,7 +103,7 @@ options:
|
|||
security_protocol:
|
||||
required: false
|
||||
default: None
|
||||
choices: ['ssl-with-validation','ssl-with-validation-custom-ca','ssl-without-validation']
|
||||
choices: ['ssl-with-validation','ssl-with-validation-custom-ca','ssl-without-validation','non-ssl']
|
||||
description: How SSL certificates should be used for HTTPS requests. defaults to None.
|
||||
certificate_authority:
|
||||
required: false
|
||||
|
@ -134,7 +140,7 @@ options:
|
|||
security_protocol:
|
||||
required: false
|
||||
default: None
|
||||
choices: ['ssl-with-validation','ssl-with-validation-custom-ca','ssl-without-validation']
|
||||
choices: ['ssl-with-validation','ssl-with-validation-custom-ca','ssl-without-validation','non-ssl']
|
||||
description: How SSL certificates should be used for HTTPS requests. defaults to None.
|
||||
certificate_authority:
|
||||
required: false
|
||||
|
@ -181,6 +187,22 @@ options:
|
|||
required: false
|
||||
default: null
|
||||
description: The CA bundle string with custom certificates. defaults to None.
|
||||
|
||||
ssh_keypair:
|
||||
required: false
|
||||
description: SSH key pair used for SSH connections to all hosts in this provider.
|
||||
default: null
|
||||
version_added: "2.5"
|
||||
suboptions:
|
||||
hostname:
|
||||
description: Director hostname.
|
||||
required: true
|
||||
userid:
|
||||
description: SSH username.
|
||||
required: false
|
||||
auth_key:
|
||||
description: SSH private key.
|
||||
required: false
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -429,6 +451,42 @@ EXAMPLES = '''
|
|||
username: 'admin'
|
||||
password: 'password'
|
||||
verify_ssl: false
|
||||
|
||||
- name: Create a new OpenStack Director provider in ManageIQ with rsa keypair
|
||||
manageiq_provider:
|
||||
name: 'EngDirector'
|
||||
type: 'Director'
|
||||
api_version: 'v3'
|
||||
state: 'present'
|
||||
provider:
|
||||
hostname: 'director.example.com'
|
||||
userid: 'admin'
|
||||
password: 'password'
|
||||
security_protocol: 'ssl-with-validation'
|
||||
verify_ssl: 'true'
|
||||
certificate_authority: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
FAKECERTsdKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBtvcGVu
|
||||
c2hpZnQtc2lnbmVyQDE1MDMzMjAxMTkwHhcNMTcwODIxMTI1NTE5WhcNMjIwODIw
|
||||
MTI1NTIwWjAmMSQwIgYDVQQDDBtvcGVuc2hpZnQtc2lnbmVyQDE1MDMzMjAxMTkw
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDUDnL2tQ2xf/zO7F7hmZ4S
|
||||
ZuwKENdI4IYuWSxye4i3hPhKg6eKPzGzmDNWkIMDOrDAj1EgVSNPtPwsOL8OWvJm
|
||||
AaTjr070D7ZGWWnrrDrWEClBx9Rx/6JAM38RT8Pu7c1hXBm0J81KufSLLYiZ/gOw
|
||||
Znks5v5RUSGcAXvLkBJeATbsbh6fKX0RgQ3fFTvqQaE/r8LxcTN1uehPX1g5AaRa
|
||||
z/SNDHaFtQlE3XcqAAukyMn4N5kdNcuwF3GlQ+tJnJv8SstPkfQcZbTMUQ7I2KpJ
|
||||
ajXnMxmBhV5fCN4rb0QUNCrk2/B+EUMBY4MnxIakqNxnN1kvgI7FBbFgrHUe6QvJ
|
||||
AgMBAAGjIzAhMA4GA1UdDwEB/wQEAwICpDAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
|
||||
SIb3DQEBCwUAA4IBAQAYRV57LUsqznSLZHA77o9+0fQetIE115DYP7wea42PODJI
|
||||
QJ+JETEfoCr0+YOMAbVmznP9GH5cMTKEWHExcIpbMBU7nMZp6A3htcJgF2fgPzOA
|
||||
aTUtzkuVCSrV//mbbYVxoFOc6sR3Br0wBs5+5iz3dBSt7xmgpMzZvqsQl655i051
|
||||
gGSTIY3z5EJmBZBjwuTjal9mMoPGA4eoTPqlITJDHQ2bdCV2oDbc7zqupGrUfZFA
|
||||
qzgieEyGzdCSRwjr1/PibA3bpwHyhD9CGD0PRVVTLhw6h6L5kuN1jA20OfzWxf/o
|
||||
XUsdmRaWiF+l4s6Dcd56SuRp5SGNa2+vP9Of/FX5
|
||||
-----END CERTIFICATE-----
|
||||
ssh_keypair:
|
||||
hostname: director.example.com
|
||||
userid: heat-admin
|
||||
auth_key: 'SecretSSHPrivateKey'
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -461,6 +519,10 @@ def supported_providers():
|
|||
Azure=dict(
|
||||
class_name='ManageIQ::Providers::Azure::CloudManager',
|
||||
),
|
||||
Director=dict(
|
||||
class_name='ManageIQ::Providers::Openstack::InfraManager',
|
||||
ssh_keypair_role="ssh_keypair"
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
@ -469,6 +531,7 @@ def endpoint_list_spec():
|
|||
provider=dict(type='dict', options=endpoint_argument_spec()),
|
||||
metrics=dict(type='dict', options=endpoint_argument_spec()),
|
||||
alerts=dict(type='dict', options=endpoint_argument_spec()),
|
||||
ssh_keypair=dict(type='dict', options=endpoint_argument_spec()),
|
||||
)
|
||||
|
||||
|
||||
|
@ -484,6 +547,7 @@ def endpoint_argument_spec():
|
|||
'ssl-with-validation',
|
||||
'ssl-with-validation-custom-ca',
|
||||
'ssl-without-validation',
|
||||
'non-ssl',
|
||||
],
|
||||
),
|
||||
userid=dict(),
|
||||
|
@ -617,7 +681,7 @@ class ManageIQProvider(object):
|
|||
|
||||
def edit_provider(self, provider, name, provider_type, endpoints, zone_id, provider_region,
|
||||
host_default_vnc_port_start, host_default_vnc_port_end,
|
||||
subscription, uid_ems):
|
||||
subscription, uid_ems, api_version):
|
||||
""" Edit a user from manageiq.
|
||||
|
||||
Returns:
|
||||
|
@ -634,6 +698,7 @@ class ManageIQProvider(object):
|
|||
host_default_vnc_port_end=host_default_vnc_port_end,
|
||||
subscription=subscription,
|
||||
uid_ems=uid_ems,
|
||||
api_version=api_version,
|
||||
)
|
||||
|
||||
# NOTE: we do not check for diff's between requested and current
|
||||
|
@ -657,7 +722,7 @@ class ManageIQProvider(object):
|
|||
|
||||
def create_provider(self, name, provider_type, endpoints, zone_id, provider_region,
|
||||
host_default_vnc_port_start, host_default_vnc_port_end,
|
||||
subscription, uid_ems):
|
||||
subscription, uid_ems, api_version):
|
||||
""" Creates the user in manageiq.
|
||||
|
||||
Returns:
|
||||
|
@ -680,6 +745,7 @@ class ManageIQProvider(object):
|
|||
host_default_vnc_port_end=host_default_vnc_port_end,
|
||||
subscription=subscription,
|
||||
uid_ems=uid_ems,
|
||||
api_version=api_version,
|
||||
connection_configurations=endpoints,
|
||||
)
|
||||
except Exception as e:
|
||||
|
@ -702,6 +768,7 @@ def main():
|
|||
host_default_vnc_port_end=dict(),
|
||||
subscription=dict(),
|
||||
azure_tenant_id=dict(),
|
||||
api_version=dict(),
|
||||
type=dict(choices=supported_providers().keys()),
|
||||
)
|
||||
# add the manageiq connection arguments to the arguments
|
||||
|
@ -727,6 +794,7 @@ def main():
|
|||
host_default_vnc_port_end = module.params['host_default_vnc_port_end']
|
||||
subscription = module.params['subscription']
|
||||
uid_ems = module.params['azure_tenant_id']
|
||||
api_version = module.params['api_version']
|
||||
state = module.params['state']
|
||||
|
||||
manageiq = ManageIQ(module)
|
||||
|
@ -774,12 +842,12 @@ def main():
|
|||
if provider:
|
||||
res_args = manageiq_provider.edit_provider(provider, name, provider_type, endpoints, zone_id, provider_region,
|
||||
host_default_vnc_port_start, host_default_vnc_port_end,
|
||||
subscription, uid_ems)
|
||||
subscription, uid_ems, api_version)
|
||||
# if we do not have a provider, create it
|
||||
else:
|
||||
res_args = manageiq_provider.create_provider(name, provider_type, endpoints, zone_id, provider_region,
|
||||
host_default_vnc_port_start, host_default_vnc_port_end,
|
||||
subscription, uid_ems)
|
||||
subscription, uid_ems, api_version)
|
||||
|
||||
module.exit_json(**res_args)
|
||||
|
||||
|
|
Loading…
Reference in a new issue