forked from ansible/workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision_lab.yml
183 lines (163 loc) · 4.4 KB
/
provision_lab.yml
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
---
- name: Perform Checks to make sure this Playbook will complete successfully
hosts: localhost
connection: local
become: false
gather_facts: true
tasks:
- name: run pre-check role to make sure workshop will complete provisioning
include_role:
name: workshop_check_setup
- name: run AWS check setup if using AWS
include_role:
name: aws_check_setup
- name: Create lab instances in AWS
hosts: localhost
connection: local
become: false
gather_facts: false
roles:
- manage_ec2_instances
- name: wait for all nodes to have SSH reachability
hosts: "managed_nodes:control_nodes:attendance"
become: true
gather_facts: false
roles:
- connectivity_test
- name: Configure nginx on attendance host
hosts: attendance
become: true
gather_facts: true
tasks:
- block:
- include_role:
name: workshop_attendance_nginx
- include_role:
name: workshop_attendance
when: attendance|bool
- name: wait for all security nodes to have SSH reachability
hosts: "security_connection_check"
become: true
gather_facts: false
roles:
- connectivity_test
- name: Configure common options on managed nodes and control nodes
hosts: "managed_nodes:control_nodes"
gather_facts: false
become: true
roles:
- user_accounts
- common
- name: configure ansible control node
hosts: control_nodes
gather_facts: true
become: true
vars:
tower_license: "{{ hostvars['localhost']['tower_license'] }}"
pre_tasks:
- debug:
var: tower_license
roles:
- role: control_node
tasks:
- include_role:
name: code_server
when:
- code_server is defined
- code_server
- towerinstall is defined
- towerinstall
- name: add dns entires for all student control nodes
hosts: control_nodes
become: true
gather_facts: false
tasks:
- include_role:
name: aws_dns
when:
- dns_type is defined
- dns_type == "aws"
- towerinstall is defined
- towerinstall
tags: control_node
- name: Setup Amazon S3 Website for Student Login
hosts: localhost
connection: local
become: false
gather_facts: false
tasks:
- include_role:
name: aws_workshop_login_page
when:
- create_login_page is defined
- create_login_page
tags: control_node
- name: populate ansible tower
hosts: control_nodes
become: true
gather_facts: false
tasks:
- name: run populate_tower role
include_role:
name: populate_tower
when:
- towerinstall is defined
- towerinstall|bool
- populatetower
- name: IBM community grid
hosts: "managed_nodes"
become: true
gather_facts: true
tasks:
- name: install boinc-client and register
include_role:
name: community_grid
when:
- ibm_community_grid is defined
- ibm_community_grid
- name: include workshop_type unique setup roles
import_playbook: "{{workshop_type}}.yml"
- name: setup demos
hosts: control_nodes
gather_facts: false
vars:
my_tower_username: admin
my_tower_password: "{{ admin_password }}"
my_tower_host: "{{ ansible_host }}"
tasks:
- name: install demo
include_role:
name: "ansible.product_demos.install_demo"
when:
- demo is defined
- towerinstall is defined
- towerinstall
- name: Alert the mothership
hosts: localhost
connection: local
become: false
gather_facts: false
tasks:
- {include_role: {name: tower_request}, when: student_total > 9}
- name: print out information for instructor
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: set facts for output
set_fact:
summary_information: |
PROVISIONER SUMMARY
*******************
- Workshop name is {{ec2_name_prefix}}
- Instructor inventory is located at {{playbook_dir}}/{{ec2_name_prefix}}/instructor_inventory.txt
- Private key is located at {{playbook_dir}}/{{ec2_name_prefix}}/{{ec2_name_prefix}}-private.pem
- {{website_information}}
- {{hostvars['attendance-host'].login_website_information | default("attendance feature is off") }}
FAILURES
*******************
{{dns_information}}
{{callback_information}}
- name: Print Summary Information
debug:
msg: "{{summary_information}}"