This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add user-facing rhsso * fix: allow override the user_sso flag from an inventory file
- Loading branch information
1 parent
1b37bdf
commit fb6b809
Showing
16 changed files
with
182 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: Include vars from rhsso | ||
include_vars: "../roles/rhsso/defaults/main.yml" | ||
- | ||
name: Install user rhsso | ||
include_role: | ||
name: rhsso | ||
tasks_from: install_sso.yml | ||
vars: | ||
sso_namespace: "{{ eval_user_rhsso_namespace }}" | ||
sso_namespace_display_name: "User Facing Red Hat Single Sign-On" | ||
rhsso_provision_immediately: true | ||
tags: ['user_rhsso'] | ||
when: user_rhsso | default(true) | bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: Include vars from rhsso | ||
include_vars: "../../roles/rhsso/defaults/main.yml" | ||
- | ||
name: Install user rhsso | ||
include_role: | ||
name: rhsso | ||
tasks_from: install_sso.yml | ||
vars: | ||
sso_namespace: "{{ eval_user_rhsso_namespace }}" | ||
sso_namespace_display_name: "User Facing Red Hat Single Sign-On" | ||
tags: ['user_rhsso'] | ||
when: user_rhsso | default(true) | bool | ||
- | ||
name: Setup backup for user rhsso | ||
include_role: | ||
name: rhsso | ||
tasks_from: backup.yaml | ||
vars: | ||
sso_namespace: "{{ eval_user_rhsso_namespace }}" | ||
tags: ['user_rhsso'] | ||
when: user_rhsso | default(true) | bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
- include_role: | ||
name: namespace | ||
vars: | ||
namespace: "{{ sso_namespace }}" | ||
display_name: "{{ sso_namespace_display_name | default('Red Hat Single Sign-On')}}" | ||
|
||
- name: Add labels to namespace | ||
shell: oc patch ns {{ sso_namespace }} --patch '{"metadata":{"labels":{"{{ monitoring_label_name }}":"{{ monitoring_label_value }}", "integreatly-middleware-service":"true"}}}' | ||
register: namespace_patch | ||
failed_when: namespace_patch.stderr != '' and 'not patched' not in namespace_patch.stderr | ||
changed_when: namespace_patch.rc == 0 | ||
|
||
- name: "Ensure {{ rhsso_imagestream_name }} tag is present for redhat sso in openshift namespace" | ||
shell: oc tag --source=docker {{ rhsso_imagestream_image }} openshift/{{ rhsso_imagestream_name }} | ||
register: result | ||
until: result.stdout | ||
retries: 50 | ||
delay: 1 | ||
failed_when: not result.stdout | ||
changed_when: False | ||
|
||
- name: "Ensure {{ rhsso_imagestream_name }} tag has an imported image in openshift namespace" | ||
shell: oc -n openshift import-image {{ rhsso_imagestream_name }} | ||
register: result | ||
until: result.stdout | ||
retries: 50 | ||
delay: 1 | ||
failed_when: not result.stdout | ||
changed_when: False | ||
|
||
- name: "Create required objects" | ||
shell: "oc create -f {{ item }} -n {{ sso_namespace }}" | ||
with_items: "{{ rhsso_operator_resource_items }}" | ||
register: rhsso_operator_resources_result | ||
failed_when: rhsso_operator_resources_result.stderr != '' and 'AlreadyExists' not in rhsso_operator_resources_result.stderr | ||
|
||
- name: "Create keycloak resource template" | ||
template: | ||
src: "keycloak.json.j2" | ||
dest: "/tmp/keycloak.json" | ||
|
||
- name: "Create keycloak resource" | ||
shell: oc create -f /tmp/keycloak.json -n {{ sso_namespace }} | ||
register: rhsso_keycloak | ||
failed_when: rhsso_keycloak.stderr != '' and 'AlreadyExists' not in rhsso_keycloak.stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- name: "Delete keycloak realm" | ||
shell: "oc delete keycloakrealm {{ rhsso_realm }} -n {{ sso_namespace }}" | ||
register: output | ||
failed_when: output.stderr != '' and 'not found' not in output.stderr and 'The system is ensuring all content is removed from this namespace.' not in output.stderr and "the server doesn't have a resource type" not in output.stderr | ||
changed_when: output.rc == 0 | ||
|
||
- name: "Delete keycloak" | ||
shell: "oc delete keycloak rhsso -n {{ sso_namespace }}" | ||
register: output | ||
failed_when: output.stderr != '' and 'not found' not in output.stderr and 'The system is ensuring all content is removed from this namespace.' not in output.stderr and "the server doesn't have a resource type" not in output.stderr | ||
changed_when: output.rc == 0 | ||
|
||
- name: "Wait for keycloak resources to be removed" | ||
shell: oc get keycloak rhsso -n {{ sso_namespace }} | ||
register: result | ||
until: not result.stdout | ||
retries: 50 | ||
delay: 10 | ||
failed_when: result.stdout | ||
changed_when: False | ||
|
||
- name: "Wait for keycloakrealms to be removed" | ||
shell: oc get keycloakrealm {{ rhsso_realm }} -n {{ sso_namespace }} | ||
register: result | ||
until: not result.stdout | ||
retries: 50 | ||
delay: 10 | ||
failed_when: result.stdout | ||
changed_when: False | ||
|
||
|
||
- name: "Delete project namespace: {{ sso_namespace }}" | ||
shell: oc delete project {{ sso_namespace }} | ||
register: output | ||
failed_when: output.stderr != '' and 'not found' not in output.stderr and 'The system is ensuring all content is removed from this namespace.' not in output.stderr | ||
changed_when: output.rc == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters