Sychronize updates to identity_role from master branch

Rename ci role to match the module name. Reverted function calls
which would break backward compatibility with previous collection
releases.

Change-Id: Ie59da441d39fe2d0e49430662d853bc9628181e0
(cherry picked from commit cc1b5ecae8)
This commit is contained in:
Rafael Castillo
2022-04-13 15:36:40 -07:00
committed by Jakob Meng
parent 9c16ee4df3
commit a3bb143f34
7 changed files with 100 additions and 48 deletions

View File

@@ -49,6 +49,10 @@ role:
returned: On success when I(state) is 'present'.
type: complex
contains:
domain_id:
description: Domain to which the role belongs
type: str
sample: default
id:
description: Unique role ID.
type: str
@@ -88,20 +92,16 @@ class IdentityRoleModule(OpenStackModule):
if self.ansible.check_mode:
self.exit_json(changed=self._system_state_change(state, role))
changed = False
if state == 'present':
if role is None:
role = self.conn.create_role(name)
role = self.conn.create_role(name=name)
changed = True
else:
changed = False
self.exit_json(changed=changed, role=role)
elif state == 'absent':
if role is None:
changed = False
else:
self.conn.delete_role(name)
changed = True
self.exit_json(changed=changed)
elif state == 'absent' and role is not None:
self.conn.identity.delete_role(role['id'])
changed = True
self.exit_json(changed=changed)
def main():