mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-26 21:43:02 +00:00
Update federation_idp_info module to use proxy layer
This patch update federation_idp_info to use proxy layer as well as add the ansible role to test the module Change-Id: I6b4544cca317f2d5fab4a9612b820872b87585f4
This commit is contained in:
@@ -11,3 +11,11 @@ remote_ids_2:
|
|||||||
- 'https://auth.example.com/auth/realms/ExampleRealm'
|
- 'https://auth.example.com/auth/realms/ExampleRealm'
|
||||||
remote_ids_3:
|
remote_ids_3:
|
||||||
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'
|
- 'https://auth.stage.example.com/auth/realms/ExampleRealm'
|
||||||
|
|
||||||
|
idp_info_expected_fields:
|
||||||
|
- description
|
||||||
|
- domain_id
|
||||||
|
- id
|
||||||
|
- is_enabled
|
||||||
|
- name
|
||||||
|
- remote_ids
|
||||||
|
|||||||
@@ -60,10 +60,9 @@
|
|||||||
openstack.cloud.federation_idp_info:
|
openstack.cloud.federation_idp_info:
|
||||||
name: '{{ idp_name }}'
|
name: '{{ idp_name }}'
|
||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
ignore_errors: yes
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is failed
|
- identity_provider_info.identity_providers | length == 0
|
||||||
|
|
||||||
- name: 'Create IDP'
|
- name: 'Create IDP'
|
||||||
openstack.cloud.federation_idp:
|
openstack.cloud.federation_idp:
|
||||||
@@ -80,14 +79,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- not idp.description
|
- not idp.description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == []
|
- idp.remote_ids == []
|
||||||
vars:
|
vars:
|
||||||
@@ -99,47 +96,33 @@
|
|||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is successful
|
|
||||||
- '"identity_providers" in identity_provider_info'
|
|
||||||
- idps | length == 1
|
- idps | length == 1
|
||||||
- '"id" in idp'
|
|
||||||
- '"name" in idp'
|
|
||||||
- '"domain_id" in idp'
|
|
||||||
- '"description" in idp'
|
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
|
||||||
- '"remote_ids" in idp'
|
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- not idp.description
|
- not idp.description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == []
|
- idp.remote_ids == []
|
||||||
vars:
|
vars:
|
||||||
idps: '{{ identity_provider_info.identity_providers }}'
|
idps: '{{ identity_provider_info.identity_providers }}'
|
||||||
idp: '{{ identity_provider_info.identity_providers[0] }}'
|
idp: '{{ identity_provider_info.identity_providers[0] }}'
|
||||||
|
|
||||||
|
- name: Verify returned values
|
||||||
|
assert:
|
||||||
|
that: item in identity_provider_info.identity_providers[0]
|
||||||
|
loop: "{{ idp_info_expected_fields }}"
|
||||||
|
|
||||||
- name: 'Fetch identity_provider info - without name'
|
- name: 'Fetch identity_provider info - without name'
|
||||||
openstack.cloud.federation_idp_info: {}
|
openstack.cloud.federation_idp_info: {}
|
||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is successful
|
|
||||||
- '"identity_providers" in identity_provider_info'
|
- '"identity_providers" in identity_provider_info'
|
||||||
# In CI we generally have a clean slate, but this might
|
# In CI we generally have a clean slate, but this might
|
||||||
# not be true for everyone...
|
# not be true for everyone...
|
||||||
- idps | length >= 1
|
- idps | length >= 1
|
||||||
- '"id" in idp'
|
|
||||||
- '"name" in idp'
|
|
||||||
- '"domain_id" in idp'
|
|
||||||
- '"description" in idp'
|
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
|
||||||
- '"remote_ids" in idp'
|
|
||||||
vars:
|
vars:
|
||||||
idps: '{{ identity_provider_info.identity_providers }}'
|
idps: '{{ identity_provider_info.identity_providers }}'
|
||||||
idp: '{{ identity_provider_info.identity_providers[0] }}'
|
|
||||||
|
|
||||||
- name: 'Create identity_provider (retry - no change) - CHECK_MODE'
|
- name: 'Create identity_provider (retry - no change) - CHECK_MODE'
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
@@ -168,14 +151,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- not idp.description
|
- not idp.description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == []
|
- idp.remote_ids == []
|
||||||
vars:
|
vars:
|
||||||
@@ -211,14 +192,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == []
|
- idp.remote_ids == []
|
||||||
vars:
|
vars:
|
||||||
@@ -251,14 +230,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == []
|
- idp.remote_ids == []
|
||||||
vars:
|
vars:
|
||||||
@@ -292,14 +269,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == remote_ids_1
|
- idp.remote_ids == remote_ids_1
|
||||||
vars:
|
vars:
|
||||||
@@ -332,14 +307,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == remote_ids_1
|
- idp.remote_ids == remote_ids_1
|
||||||
vars:
|
vars:
|
||||||
@@ -373,14 +346,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_1
|
- idp.remote_ids == remote_ids_1
|
||||||
vars:
|
vars:
|
||||||
@@ -413,14 +384,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_1
|
- idp.remote_ids == remote_ids_1
|
||||||
vars:
|
vars:
|
||||||
@@ -452,14 +421,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_1
|
- idp.remote_ids == remote_ids_1
|
||||||
vars:
|
vars:
|
||||||
@@ -499,14 +466,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description_2
|
- idp.description == idp_description_2
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == remote_ids_2
|
- idp.remote_ids == remote_ids_2
|
||||||
vars:
|
vars:
|
||||||
@@ -543,14 +508,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name
|
- idp.id == idp_name
|
||||||
- idp.name == idp_name
|
- idp.name == idp_name
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description_2
|
- idp.description == idp_description_2
|
||||||
- idp.enabled == True
|
|
||||||
- idp.is_enabled == True
|
- idp.is_enabled == True
|
||||||
- idp.remote_ids == remote_ids_2
|
- idp.remote_ids == remote_ids_2
|
||||||
vars:
|
vars:
|
||||||
@@ -592,14 +555,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name_2
|
- idp.id == idp_name_2
|
||||||
- idp.name == idp_name_2
|
- idp.name == idp_name_2
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_3
|
- idp.remote_ids == remote_ids_3
|
||||||
vars:
|
vars:
|
||||||
@@ -638,14 +599,12 @@
|
|||||||
- '"name" in idp'
|
- '"name" in idp'
|
||||||
- '"domain_id" in idp'
|
- '"domain_id" in idp'
|
||||||
- '"description" in idp'
|
- '"description" in idp'
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
- '"is_enabled" in idp'
|
||||||
- '"remote_ids" in idp'
|
- '"remote_ids" in idp'
|
||||||
- idp.id == idp_name_2
|
- idp.id == idp_name_2
|
||||||
- idp.name == idp_name_2
|
- idp.name == idp_name_2
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_3
|
- idp.remote_ids == remote_ids_3
|
||||||
vars:
|
vars:
|
||||||
@@ -658,21 +617,11 @@
|
|||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is successful
|
|
||||||
- '"identity_providers" in identity_provider_info'
|
|
||||||
- identity_provider_info.identity_providers | length == 1
|
- identity_provider_info.identity_providers | length == 1
|
||||||
- '"id" in idp'
|
|
||||||
- '"name" in idp'
|
|
||||||
- '"domain_id" in idp'
|
|
||||||
- '"description" in idp'
|
|
||||||
- '"enabled" in idp'
|
|
||||||
- '"is_enabled" in idp'
|
|
||||||
- '"remote_ids" in idp'
|
|
||||||
- idp.id == idp_name_2
|
- idp.id == idp_name_2
|
||||||
- idp.name == idp_name_2
|
- idp.name == idp_name_2
|
||||||
- idp.domain_id == domain_id
|
- idp.domain_id == domain_id
|
||||||
- idp.description == idp_description
|
- idp.description == idp_description
|
||||||
- idp.enabled == False
|
|
||||||
- idp.is_enabled == False
|
- idp.is_enabled == False
|
||||||
- idp.remote_ids == remote_ids_3
|
- idp.remote_ids == remote_ids_3
|
||||||
vars:
|
vars:
|
||||||
@@ -684,25 +633,9 @@
|
|||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is successful
|
|
||||||
- '"identity_providers" in identity_provider_info'
|
|
||||||
# In CI we generally have a clean slate, but this might
|
# In CI we generally have a clean slate, but this might
|
||||||
# not be true for everyone...
|
# not be true for everyone...
|
||||||
- identity_provider_info.identity_providers | length >= 2
|
- identity_provider_info.identity_providers | length >= 2
|
||||||
- '"id" in idp_0'
|
|
||||||
- '"name" in idp_0'
|
|
||||||
- '"domain_id" in idp_0'
|
|
||||||
- '"description" in idp_0'
|
|
||||||
- '"enabled" in idp_0'
|
|
||||||
- '"is_enabled" in idp_0'
|
|
||||||
- '"remote_ids" in idp_0'
|
|
||||||
- '"id" in idp_1'
|
|
||||||
- '"name" in idp_1'
|
|
||||||
- '"domain_id" in idp_1'
|
|
||||||
- '"description" in idp_1'
|
|
||||||
- '"enabled" in idp_1'
|
|
||||||
- '"is_enabled" in idp_1'
|
|
||||||
- '"remote_ids" in idp_1'
|
|
||||||
# In theory these could be attached to different IDPs but let's keep
|
# In theory these could be attached to different IDPs but let's keep
|
||||||
# things simple
|
# things simple
|
||||||
- idp_name in (identity_provider_info.identity_providers | map(attribute='id'))
|
- idp_name in (identity_provider_info.identity_providers | map(attribute='id'))
|
||||||
@@ -712,13 +645,8 @@
|
|||||||
- domain_id in (identity_provider_info.identity_providers | map(attribute='domain_id'))
|
- domain_id in (identity_provider_info.identity_providers | map(attribute='domain_id'))
|
||||||
- idp_description in (identity_provider_info.identity_providers | map(attribute='description'))
|
- idp_description in (identity_provider_info.identity_providers | map(attribute='description'))
|
||||||
- idp_description_2 in (identity_provider_info.identity_providers | map(attribute='description'))
|
- idp_description_2 in (identity_provider_info.identity_providers | map(attribute='description'))
|
||||||
- True in (identity_provider_info.identity_providers | map(attribute='enabled'))
|
|
||||||
- False in (identity_provider_info.identity_providers | map(attribute='enabled'))
|
|
||||||
- True in (identity_provider_info.identity_providers | map(attribute='is_enabled'))
|
- True in (identity_provider_info.identity_providers | map(attribute='is_enabled'))
|
||||||
- False in (identity_provider_info.identity_providers | map(attribute='is_enabled'))
|
- False in (identity_provider_info.identity_providers | map(attribute='is_enabled'))
|
||||||
vars:
|
|
||||||
idp_0: '{{ identity_provider_info.identity_providers[0] }}'
|
|
||||||
idp_1: '{{ identity_provider_info.identity_providers[1] }}'
|
|
||||||
|
|
||||||
- name: 'Delete identity_provider - CHECK_MODE'
|
- name: 'Delete identity_provider - CHECK_MODE'
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
@@ -766,10 +694,9 @@
|
|||||||
openstack.cloud.federation_idp_info:
|
openstack.cloud.federation_idp_info:
|
||||||
name: '{{ idp_name }}'
|
name: '{{ idp_name }}'
|
||||||
register: identity_provider_info
|
register: identity_provider_info
|
||||||
ignore_errors: True
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- identity_provider_info is failed
|
- identity_provider_info.identity_providers | length == 0
|
||||||
|
|
||||||
- name: 'Delete second identity_provider'
|
- name: 'Delete second identity_provider'
|
||||||
openstack.cloud.federation_idp:
|
openstack.cloud.federation_idp:
|
||||||
|
|||||||
@@ -11,18 +11,16 @@ short_description: Get the information about the available federation identity
|
|||||||
providers
|
providers
|
||||||
author: OpenStack Ansible SIG
|
author: OpenStack Ansible SIG
|
||||||
description:
|
description:
|
||||||
- Fetch a federation identity provider.
|
- Fetch available federation identity providers.
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the identity provider to fetch.
|
- The name of the identity provider to fetch.
|
||||||
- If I(name) is specified, the module will return failed if the identity
|
|
||||||
provider doesn't exist.
|
|
||||||
type: str
|
type: str
|
||||||
aliases: ['id']
|
aliases: ['id']
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 3.6"
|
- "python >= 3.6"
|
||||||
- "openstacksdk >= 0.44"
|
- "openstacksdk"
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- openstack.cloud.openstack
|
- openstack.cloud.openstack
|
||||||
'''
|
'''
|
||||||
@@ -39,6 +37,34 @@ EXAMPLES = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
identity_providers:
|
||||||
|
description: Dictionary describing the identity providers
|
||||||
|
returned: success
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
contains:
|
||||||
|
description:
|
||||||
|
description: Identity provider description
|
||||||
|
type: str
|
||||||
|
sample: "demodescription"
|
||||||
|
domain_id:
|
||||||
|
description: Domain to which the identity provider belongs
|
||||||
|
type: str
|
||||||
|
sample: "default"
|
||||||
|
id:
|
||||||
|
description: Identity provider ID
|
||||||
|
type: str
|
||||||
|
sample: "test-idp"
|
||||||
|
is_enabled:
|
||||||
|
description: Indicates wether the identity provider is enabled
|
||||||
|
type: bool
|
||||||
|
name:
|
||||||
|
description: Name of the identity provider, equals its ID.
|
||||||
|
type: str
|
||||||
|
sample: "test-idp"
|
||||||
|
remote_ids:
|
||||||
|
description: Remote IDs associated with the identity provider
|
||||||
|
type: list
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
|
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import OpenStackModule
|
||||||
@@ -52,34 +78,18 @@ class IdentityFederationIdpInfoModule(OpenStackModule):
|
|||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def normalize_idp(self, idp):
|
|
||||||
"""
|
|
||||||
Normalizes the IDP definitions so that the outputs are consistent with the
|
|
||||||
parameters
|
|
||||||
|
|
||||||
- "enabled" (parameter) == "is_enabled" (SDK)
|
|
||||||
- "name" (parameter) == "id" (SDK)
|
|
||||||
"""
|
|
||||||
if idp is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
_idp = idp.to_dict()
|
|
||||||
_idp['enabled'] = idp['is_enabled']
|
|
||||||
_idp['name'] = idp['id']
|
|
||||||
return _idp
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
""" Module entry point """
|
""" Module entry point """
|
||||||
|
|
||||||
name = self.params.get('name')
|
name = self.params['name']
|
||||||
|
|
||||||
|
query = {}
|
||||||
if name:
|
if name:
|
||||||
idp = self.normalize_idp(self.conn.identity.get_identity_provider(name))
|
query["id"] = name
|
||||||
self.exit_json(changed=False, identity_providers=[idp])
|
|
||||||
|
|
||||||
else:
|
idps = self.conn.identity.identity_providers(**query)
|
||||||
providers = list(map(self.normalize_idp, self.conn.identity.identity_providers()))
|
idps = [idp.to_dict(computed=False) for idp in idps]
|
||||||
self.exit_json(changed=False, identity_providers=providers)
|
self.exit_json(changed=False, identity_providers=idps)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user