Omit passing the project when no project scope is needed
With recent changes to role_assignment module, passing an empty `project` is treated as an error, as module attempts to set project scope even when project is null or is empty. In order to overcome this we apply extra logic to preserve current behavior while allowing to avoid passing project when the value is passed as an empty ones by roles, like Heat[1] [1]8dd53ea2f1/tasks/heat_service_setup.yml (L61)Closes-Bug: #2103512 Change-Id: Ic088dfd7aa0958d66d4fa2b10d8e72496cbb7a71 (cherry picked from commit7b579a69eb)
This commit is contained in:
@@ -36,12 +36,13 @@
|
||||
- name: Add service users to roles
|
||||
vars:
|
||||
role_mapping: "{{ (role is string) | ternary({'name': role, 'state': 'present'}, role) }}"
|
||||
user_project: "{{ user.project | default(_service_project_name) }}"
|
||||
openstack.cloud.role_assignment:
|
||||
cloud: "{{ _service_cloud_name }}"
|
||||
state: "{{ role_mapping['state'] | default('present') }}"
|
||||
user: "{{ user.name }}"
|
||||
role: "{{ role_mapping['name'] }}"
|
||||
project: "{{ user.project | default(_service_project_name) }}"
|
||||
project: "{{ (user_project is truthy) | ternary(user_project, omit) }}"
|
||||
domain: "{{ user.domain | default('default') }}"
|
||||
endpoint_type: admin
|
||||
validate_certs: "{{ not (_service_adminuri_insecure | default(True) | bool) }}"
|
||||
|
||||
Reference in New Issue
Block a user