-
Notifications
You must be signed in to change notification settings - Fork 524
Expand file tree
/
Copy pathpost_software.yml
More file actions
189 lines (168 loc) · 6.27 KB
/
post_software.yml
File metadata and controls
189 lines (168 loc) · 6.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
- name: Step 005 post software
hosts: localhost
gather_facts: false
become: true
tags:
- step005_01
- post_software
tasks:
- debug:
msg: "Post-Software tasks Started"
# ----------------------------------------------------------------------
# Post-Software Workloads as role
# ----------------------------------------------------------------------
- name: Import Post-software workloads
import_playbook: >-
{{ 'workloads.yml' if post_software_workloads is mapping else 'noop.yml' }}
vars:
_workload_title_: "Post Software"
_workloads_: "{{ post_software_workloads | default([]) }}"
- name: Run host_workloads for post_software_workloads
any_errors_fatal: true
hosts: all:localhost
gather_facts: false
tags:
- step005
- post_software
tasks:
- name: Include host_workloads for post_software
when:
- post_software_workloads is iterable
- post_software_workloads is not mapping
- post_software_workloads is not string
vars:
agnosticd_stage: post_software
host_workloads: "{{ post_software_workloads }}"
ansible.builtin.include_role:
name: host_workloads
- name: Deploy user setup
hosts: localhost
gather_facts: false
become: true
tags:
- step005
- post_software
tasks:
- name: Report Access Information for CNV
when:
- cloud_provider == "openshift_cnv"
vars:
_bastion_inventory_name: "{{ groups['bastions'][0] }}"
_bastion_ssh_password: "{{ hostvars[bastion_hostname]['student_password'] }}"
_kubeadmin_password: "{{ hostvars[bastion_hostname]['kubeadmin_password']['content'] | b64decode }}"
block:
- name: Print access user info
agnosticd_user_info:
msg: |
You can access your bastion via SSH:
ssh {{ student_name }}@{{ openshift_cnv_ssh_address }} -p {{ hostvars[groups['bastions'][0]].bastion_ssh_port }}
Enter ssh password when prompted: {{ hostvars[groups['bastions'][0]]['student_password'] }}
- name: Print the external instance IP
agnosticd_user_info:
msg: |
Use the IP {{ hostvars[bastion_hostname]['external_ip']}} to access ports: {{ hostvars[bastion_hostname]['external_ports'] }}
when:
- "'external_ip' in hostvars[bastion_hostname]"
- name: save user data
agnosticd_user_info:
data:
cloud_provider: "{{ cloud_provider }}"
ssh_command: "ssh {{ student_name }}@{{ openshift_cnv_ssh_address }} -p {{ hostvars[groups['bastions'][0]].bastion_ssh_port }}"
ssh_password: "{{ student_password }}"
ssh_username: "{{ student_name }}"
guid: "{{ guid }}"
targethost: "{{ groups['bastions'][0] | regex_replace('\\..*$') }}.{{ guid }}{{ subdomain_base_suffix }}"
targetport: "{{ hostvars[groups['bastions'][0]].bastion_ssh_port }}"
subdomain: "{{ guid }}{{ subdomain_base_suffix }}"
subdomain_internal: "{{ chomped_zone_internal_dns | default('') }}"
vars:
student_name: "{{ ansible_service_account_user_name }}"
register: r_user_data
- name: Output ssh user_info for ec2 based deploys
when:
- cloud_provider == "ec2"
vars:
student_password: "{{ hostvars[groups['bastions'][0]]['student_password'] }}"
student_username: "{{ hostvars[groups['bastions'][0]]['student_name'] }}"
block:
- name: Set ssh user_info
agnosticd_user_info:
msg: "{{ __user_info }}"
loop:
- "To Access development node via SSH:"
- "ssh_command: ssh {{ student_name }}@{{ groups['bastions'][0] | regex_replace('\\..*$') }}.{{ guid }}{{ subdomain_base_suffix }}"
- "Enter ssh password when prompted: {{ student_password }}"
- ""
loop_control:
loop_var: __user_info
- name: Save user data
agnosticd_user_info:
data:
cloud_provider: "{{ cloud_provider }}"
ssh_command: "ssh {{ student_name }}@{{ groups['bastions'][0] | regex_replace('\\..*$') }}.{{ guid }}{{ subdomain_base_suffix }}"
ssh_password: "{{ student_password }}"
ssh_username: "{{ student_name }}"
guid: "{{ guid }}"
targethost: "{{ groups['bastions'][0] | regex_replace('\\..*$') }}.{{ guid }}{{ subdomain_base_suffix }}"
subdomain: "{{ guid }}{{ subdomain_base_suffix }}"
subdomain_internal: "{{ chomped_zone_internal_dns | default('') }}"
vars:
student_name: "{{ ansible_service_account_user_name }}"
register: r_user_data
- name: Deploy Bookbag
when: bookbag_git_repo is defined
ansible.builtin.include_role:
name: bookbag
vars:
ACTION: create
- name: PostSoftware flight-check
hosts: bastions[0]
gather_facts: true
become: true
tags:
- showroom
tasks:
- name: Deploy Showroom Web Interface
when:
- showroom_git_repo is defined
ansible.builtin.include_role:
name: showroom
- name: Post Software Configuration - Reset Repos
hosts: bastions[0]
gather_facts: true
become: true
tags:
- reset-repositories
tasks:
- name: Reset RHSM Repositories to Original State
when: reset_rhsm_conf | default(false) | bool
ansible.builtin.include_role:
name: reset-repositories
- name: Post Software Configuration - Lab Roles
hosts: all:!localhost
gather_facts: false
become: false
tags:
- ansible_idm_setup_lab
tasks:
- name: Configure environment for lab
when: ansible_idm_setup_lab | default(false) | bool
ansible.builtin.include_role:
name: ansible_idm_setup_lab
- name: PostSoftware flight-check
hosts: localhost
connection: local
gather_facts: false
become: false
tags:
- post_flight_check
tasks:
- name: Deploy Showroom on shared cluster
when: showroom_deploy_shared_cluster_enable | default(false) | bool
ansible.builtin.include_role:
name: ocp4_workload_showroom
- name: "Post-Software checks completed successfully"
ansible.builtin.debug:
msg: "Post-Software checks completed successfully"
...