commit | author | age
|
bf4161
|
1 |
--- |
JR |
2 |
# Implement your Workload deployment tasks here |
|
3 |
|
|
4 |
- name: Setting up workload for user |
|
5 |
debug: |
|
6 |
msg: "Setting up workload for user ocp_username = {{ ocp_username }}" |
|
7 |
|
|
8 |
- include_role: |
|
9 |
name: mysql |
|
10 |
vars: |
|
11 |
become_override: yes |
30a6b5
|
12 |
|
JR |
13 |
- name: Install AWS python prerequisites |
|
14 |
become: True |
|
15 |
pip: |
|
16 |
state: present |
|
17 |
name: |
|
18 |
- boto |
|
19 |
- botocore |
|
20 |
- boto3 |
bf4161
|
21 |
|
JR |
22 |
# Find public IP of bastion |
|
23 |
- name: Gather VPC facts |
|
24 |
ec2_vpc_net_facts: |
|
25 |
filters: |
|
26 |
tag:Name: "{{ aws_vpc_name }}" |
|
27 |
region: "{{ aws_region_final | default(aws_region) }}" |
|
28 |
register: vpc |
|
29 |
|
|
30 |
- name: Get instance facts |
|
31 |
ec2_instance_facts: |
|
32 |
filters: |
|
33 |
# FIXME - find a better way to discover the bastion name |
|
34 |
"tag:Name": "{{ instances[0].name }}" |
|
35 |
region: "{{ aws_region_final | default(aws_region) }}" |
|
36 |
register: instancesr |
|
37 |
failed_when: instancesr|length == 0 |
|
38 |
|
|
39 |
- name: Get non-terminated instance |
|
40 |
set_fact: |
|
41 |
ec2instance: "{{ item }}" |
|
42 |
with_items: |
|
43 |
- "{{ instancesr.instances }}" |
|
44 |
when: not item.state.name == 'terminated' |
|
45 |
failed_when: ec2instance is undefined |
|
46 |
|
|
47 |
# Make external DNS of MySQL available to OpenShift cluster |
|
48 |
- name: Get cluster metadata |
|
49 |
slurp: |
|
50 |
path: "{{ cluster_name }}/metadata.json" |
|
51 |
register: metadata |
|
52 |
|
|
53 |
- name: Get cluster infrastructure ID |
|
54 |
set_fact: |
|
55 |
cluster_vpc_name: "{{ metadata.content | b64decode | from_json | json_query('infraID')}}-vpc" |
|
56 |
|
|
57 |
- name: Gather Cluster VPC facts |
|
58 |
ec2_vpc_net_facts: |
|
59 |
filters: |
|
60 |
tag:Name: "{{ cluster_vpc_name }}" |
|
61 |
region: "{{ aws_region_final | default(aws_region) }}" |
|
62 |
register: cluster_vpc |
|
63 |
failed_when: cluster_vpc.vpcs | length == 0 |
|
64 |
|
|
65 |
- name: Create Private DNS Entry for MySQL in cluster private zone |
|
66 |
route53: |
|
67 |
state: present |
|
68 |
overwrite: yes |
|
69 |
private_zone: yes |
|
70 |
record: "{{ mysql_dns_name }}" |
|
71 |
type: A |
|
72 |
ttl: 60 |
|
73 |
value: "{{ ec2instance.public_ip_address }}" |
|
74 |
zone: "{{ cluster_name }}{{ subdomain_base_suffix }}." |
|
75 |
vpc_id: "{{ cluster_vpc.vpcs[0].vpc_id }}" |
|
76 |
|
|
77 |
# Leave this as the last task in the playbook. |
|
78 |
- name: workload tasks complete |
|
79 |
debug: |
|
80 |
msg: "Workload Tasks completed successfully." |
|
81 |
when: not silent|bool |