Skip to content

Commit

Permalink
Remove ipa_host variable from manage-participants (#94)
Browse files Browse the repository at this point in the history
* Remove ipa_host variable from manage-participants

The ipa_host variable should be set at main entry point based on
ocp_subdomain and subdomain_base_suffix variables provided externally.

* Adding checks for ocp_subdomain and subdomain_base_suffix vars

* Adding additional information to the variables check

- Adding empty check for ocp_subdomain and subdomain_base_suffix
  variables
- Additional output for error message

* Minor formatting update

Co-authored-by: Øystein Bedin <[email protected]>
  • Loading branch information
makirill and oybed authored Dec 6, 2021
1 parent 8b00aa2 commit 6ece51e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 0 additions & 2 deletions inventory-generation/identity-management/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
- name: "Set Identity Provider facts"
set_fact:
idp_type: "{{ idp_type | default('idm') }}"
ipa_host: "{{ idp_host_url if idp_host_url is defined else 'ipa.apps.' + (hosting_environments[0].ocp_sub_domain | lower) + '.' + engagement_region | default('dev') + '-1.' + ocp_base_url }}"
ipa_admin_user: "{{ ocp_admin_username }}"
ipa_admin_password: "{{ ocp_admin_password }}"
ipa_validate_certs: "{{ ipa_validate_certs | default(true) }}"
Expand All @@ -99,7 +98,6 @@
project_name: "{{ project_name }}"
ocp_subdomain: "{{ hosting_environments[0].ocp_sub_domain | lower }}"
ipa_validate_certs: "{{ ipa_validate_certs }}"
ipa_host: "{{ ipa_host }}"
ipa_admin_user: "{{ ipa_admin_user }}"
ipa_admin_password: "{{ ipa_admin_password }}"
list_of_mail_cc: "{{ cc_list }}"
Expand Down
11 changes: 9 additions & 2 deletions manage-participants/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
- hosts: identity-hosts
name: Verify Identity Provider
tasks:
- name: "Fail if ocp_subdomain or subdomain_base_suffix not provided"
fail:
msg: "Variable ocp_subdomain ({{ ocp_subdomain | default('')}}) or subdomain_base_suffix ({{ subdomain_base_suffix | default('') }}) is not defined or empty"
when:
- (ocp_subdomain is undefined or ocp_subdomain|trim == "") or
(subdomain_base_suffix is undefined or subdomain_base_suffix|trim == "")

- set_fact:
ipa_host: "ipa.apps.{{ ocp_subdomain }}.{{ subdomain_base_suffix }}"

- name: Wait for IdM to be responsive
uri:
Expand All @@ -12,8 +21,6 @@
until: rc.status|trim|int == 200
retries: 90
delay: 60
when:
- ipa_host is defined

- name: Remove participants from IdM
import_playbook: "process_remove.yml"
Expand Down

0 comments on commit 6ece51e

Please sign in to comment.