|
16 | 16 | type: Opaque |
17 | 17 | EOF |
18 | 18 |
|
| 19 | +- name: Set IPA BaseDN var |
| 20 | + ansible.builtin.set_fact: |
| 21 | + ipa_basedn: "dc={{ ipa_hostname.split('.')[1:] | join(',dc=') }}" |
| 22 | + when: enable_keystone_ldap | default(false) | bool |
| 23 | + |
| 24 | +- name: Create Keystone domain config secret for LDAP |
| 25 | + ansible.builtin.shell: | |
| 26 | + {{ shell_header }} |
| 27 | + {{ oc_header }} |
| 28 | + cat <<EOF | oc apply -n openstack -f - |
| 29 | + apiVersion: v1 |
| 30 | + kind: Secret |
| 31 | + metadata: |
| 32 | + name: keystone-domains |
| 33 | + type: Opaque |
| 34 | + stringData: |
| 35 | + keystone.{{ ipa_domain | default('REDHAT') }}.conf: | |
| 36 | + [identity] |
| 37 | + driver = ldap |
| 38 | + [ldap] |
| 39 | + url = ldaps://osp-free-ipa-0.ooo.test |
| 40 | + user = uid=svc-ldap,cn=users,cn=accounts,{{ ipa_basedn }} |
| 41 | + password = {{ ipa_admin_password | default('nomoresecrets') }} |
| 42 | + suffix = {{ ipa_basedn }} |
| 43 | + user_tree_dn = cn=users,cn=accounts,{{ ipa_basedn }} |
| 44 | + user_objectclass = person |
| 45 | + user_id_attribute = uid |
| 46 | + user_name_attribute = uid |
| 47 | + user_mail_attribute = mail |
| 48 | + group_tree_dn = cn=groups,cn=accounts,{{ ipa_basedn }} |
| 49 | + group_objectclass = groupOfNames |
| 50 | + group_id_attribute = cn |
| 51 | + group_name_attribute = cn |
| 52 | + group_member_attribute = member |
| 53 | + group_desc_attribute = description |
| 54 | + EOF |
| 55 | + when: enable_keystone_ldap | default(false) | bool |
| 56 | + |
19 | 57 | - name: deploy podified Keystone |
20 | 58 | ansible.builtin.shell: | |
21 | 59 | {{ shell_header }} |
22 | 60 | {{ oc_header }} |
23 | 61 | if {{ enable_federation | default(false) | lower }} == true; then |
24 | 62 | oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch_federation }}' |
| 63 | + elif {{ enable_keystone_ldap | default(false) | lower }}; then |
| 64 | + oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch_ldap }}' |
25 | 65 | else |
26 | 66 | oc patch openstackcontrolplane openstack --type=merge --patch '{{ keystone_patch }}' |
27 | 67 | fi |
|
183 | 223 | ${BASH_ALIASES[openstack]} credential show {{ before_adoption_credential.stdout }} -f value -c blob |
184 | 224 | register: after_adoption_credential |
185 | 225 | failed_when: after_adoption_credential.stdout != 'test' |
| 226 | + |
| 227 | +- name: get ldap user token |
| 228 | + ansible.builtin.shell: | |
| 229 | + {{ shell_header }} |
| 230 | + {{ oc_header }} |
| 231 | +
|
| 232 | + alias openstack="oc exec -t openstackclient -- openstack" |
| 233 | +
|
| 234 | + auth_url=$(${BASH_ALIASES[openstack]} endpoint list --service keystone --interface public -f value -c URL) |
| 235 | +
|
| 236 | + alias openstack="oc exec -t openstackclient -- env -u OS_CLOUD - OS_AUTH_URL=${auth_url} OS_USERNAME=ipauser1 OS_PASSWORD={{ ipa_user_password }} OS_PROJECT_DOMAIN_NAME=REDHAT OS_USER_DOMAIN_NAME=REDHAT openstack" |
| 237 | +
|
| 238 | + ${BASH_ALIASES[openstack]} token issue -f json |
| 239 | + register: keystone_ldap_responding_result |
| 240 | + when: enable_keystone_ldap | default(false) | bool |
| 241 | + |
| 242 | +- name: Print ldap user token |
| 243 | + ansible.builtin.debug: |
| 244 | + var: keystone_ldap_responding_result |
| 245 | + when: enable_keystone_ldap | default(false) | bool |
0 commit comments