Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default EE to fix wait for sync #247

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions playbooks/override_ee.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# RHPDS virtualenvs -> EE automatic creation
- name: Override EE with default_execution_environment if not defined
vars:
ansible_control_plane: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.type | default('tower') }}

execution_environment: >-
{{ vars.catalog_item_params.__meta__.deployer.execution_environment | default({}) }}

default_execution_environment:
image: image-registry.apps-dev.open.redhat.com/agnosticd/ee-{{ vars.catalog_item_params.__meta__.deployer.virtualenv | default('ansible2.9-python3.6-2021-11-30') }}
private: true

to_merge:
__meta__:
deployer:
execution_environment: "{{ default_execution_environment }}"
when: >-
ansible_control_plane == 'controller'
and execution_environment | default('', true) == ''

set_fact:
catalog_item_params: "{{ vars.catalog_item_params | combine(to_merge, recursive=True) }}"
9 changes: 7 additions & 2 deletions playbooks/service-destroy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
catalog_stage: CHANGE ME dev|test|prod
catalog_item_params_file: CHANGEME
kubeconfig: CHANGEME
babylon_tower_secret: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.secret
| default('babylon-tower') }}

# After that don't touch
catalog_item_name: "{{ account | replace('_', '-') }}.{{ catalog_item | lower | regex_replace('_', '-') }}.{{ catalog_stage }}"
Expand All @@ -20,6 +23,8 @@
file: "{{ catalog_item_params_file }}"
name: catalog_item_params

- include_tasks: override_ee.yaml

- name: Show catalog_item_params
debug:
var: catalog_item_params
Expand Down Expand Up @@ -223,11 +228,11 @@
api_version: v1
kind: Secret
namespace: "{{ anarchy_namespace }}"
name: babylon-tower
name: "{{ babylon_tower_secret }}"
register: r_babylon_tower_secret

- fail:
msg: "babylon-tower secret not found"
msg: "{{ babylon_tower_secret }} secret not found"
when: r_babylon_tower_secret.resources | length == 0

- set_fact:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/service-lifecycle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# After that don't touch
catalog_item_name: "{{ account | replace('_', '-') }}.{{ catalog_item | lower | regex_replace('_', '-') }}.{{ catalog_stage }}"

babylon_tower_secret: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.secret
| default('babylon-tower') }}

tasks:
- name: Git minimal facts
ansible.builtin.setup:
Expand All @@ -39,6 +43,8 @@
file: "{{ catalog_item_params_file }}"
name: catalog_item_params

- include_tasks: override_ee.yaml

- name: Show catalog_item_params
debug:
var: catalog_item_params
Expand Down Expand Up @@ -196,7 +202,7 @@
api_version: v1
kind: Secret
namespace: "{{ anarchy_namespace }}"
name: babylon-tower
name: "{{ babylon_tower_secret }}"
register: r_babylon_tower_secret
failed_when: >-
r_babylon_tower_secret.resources | length != 1
Expand Down
9 changes: 7 additions & 2 deletions playbooks/service-provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
kubeconfig: CHANGEME
platform: CHANGEME
cloudforms_username: CHANGEME
babylon_tower_secret: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.secret
| default('babylon-tower') }}

# After that don't touch
user_namespace: user-{{ cloudforms_username | replace('_', '-') | replace('.', '-') }}
Expand All @@ -28,6 +31,8 @@
file: "{{ catalog_item_params_file }}"
name: catalog_item_params

- include_tasks: override_ee.yaml

- name: Show catalog_item_params
debug:
var: vars.catalog_item_params
Expand Down Expand Up @@ -408,12 +413,12 @@
api_version: v1
kind: Secret
namespace: "{{ anarchy_namespace }}"
name: babylon-tower
name: "{{ babylon_tower_secret }}"
register: r_babylon_tower_secret

- name: Fail if babylon-tower secret not found
fail:
msg: "babylon-tower secret not found"
msg: "{{ babylon_tower_secret }} secret not found"
when: r_babylon_tower_secret.resources | length == 0

- name: Create output_dir/secrets
Expand Down
8 changes: 7 additions & 1 deletion playbooks/service-status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# After that don't touch
catalog_item_name: "{{ account | replace('_', '-') }}.{{ catalog_item | lower | regex_replace('_', '-') }}.{{ catalog_stage }}"

babylon_tower_secret: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.secret
| default('babylon-tower') }}

tasks:
- name: Get minimal ansible_facts
ansible.builtin.gather_facts:
Expand All @@ -24,6 +28,8 @@
file: "{{ catalog_item_params_file }}"
name: catalog_item_params

- include_tasks: override_ee.yaml

- name: Show catalog_item_params
debug:
var: catalog_item_params
Expand Down Expand Up @@ -188,7 +194,7 @@
api_version: v1
kind: Secret
namespace: "{{ anarchy_namespace }}"
name: babylon-tower
name: "{{ babylon_tower_secret }}"
register: r_babylon_tower_secret
failed_when: >-
r_babylon_tower_secret.resources | length != 1
Expand Down