---
|
# Implement your Pre Workload deployment tasks here
|
|
- name: Ensuring AWS region is defined
|
fail:
|
msg: "This workload requires aws_region to be defined. Exiting..."
|
when: aws_region is not defined
|
|
- name: usercount debug
|
debug:
|
msg: "Debugging num_users {{ num_users }}"
|
|
- name: create usernames
|
set_fact:
|
users: "{{ users | default([]) + ['user'+item | string] }}"
|
loop: "{{ range(1,((num_users | int) + 1)) | list }}"
|
|
# Figure out paths
|
- name: extract api_url
|
command: oc whoami --show-server
|
register: api_url_r
|
|
- name: set the master
|
set_fact:
|
master_url: "{{ api_url_r.stdout | trim }}"
|
|
- name: extract console_url
|
command: oc whoami --show-console
|
register: console_url_r
|
|
- name: set the console
|
set_fact:
|
console_url: "{{ console_url_r.stdout | trim }}"
|
|
- name: extract route_subdomain
|
k8s_facts:
|
kind: Ingress
|
register: route_subdomain_r
|
|
- name: set the route
|
set_fact:
|
route_subdomain: "{{ route_subdomain_r.resources[0].spec.domain | trim }}"
|
|
- name: set bastion_fqdn
|
set_fact:
|
bastion_fqdn: "{{ subdomain_base }}"
|
|
- name: debug values
|
debug:
|
msg:
|
- "master URL: {{ master_url }}"
|
- "console URL: {{ console_url }}"
|
- "route subdomain: {{ route_subdomain }}"
|
- "ocp_username: {{ ocp_username }}"
|
- "bastion host: {{ bastion_fqdn }}"
|
|
|
# Leave this as the last task in the playbook.
|
- name: pre_workload tasks complete
|
debug:
|
msg: "Pre-Workload tasks completed successfully."
|
when: not silent|bool
|