-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaws-ha-sol-broker-centosnodes.yml
215 lines (207 loc) · 10.5 KB
/
aws-ha-sol-broker-centosnodes.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
#------------------------------------------------------------------------------------#
- hosts: sol_brokers
remote_user: centos # login as user centos
become: true # Run as Root
pre_tasks:
- include_vars: vars/common-sol-brokers-vars.yml # Load common variables for the Ansible Tasks and Roles from this file
- include_vars: vars/aws-ha-sol-brokers-vars.yml # Load AWS variables for HA Solace Brokers from this file
tasks:
#####################################################
# Enable SWAP on the broker
#####################################################
- include_role:
name: centos/aws-swap-bootstrap
#####################################################
# Install Docker CE
#####################################################
- include_role:
name: centos/suzuki-shunsuke.docker_ce_centos
#------------------------------------------------------------------------------------#
- hosts: ha_sol_primary_nodes:ha_sol_backup_nodes
remote_user: centos # login as user centos
become: true # Run as Root
tasks:
#####################################################
# Format, Partition External Disk, and prepare for Broker Usage
#####################################################
- include_role:
name: solace/solace-exstorage-bootstrap
vars:
# AWS M5 Instances
solace_mount_dev: /dev/nvme1n1
solace_storage_part: /dev/nvme1n1p1
#------------------------------------------------------------------------------------#
- hosts: ha_sol_monitor_nodes
remote_user: centos # login as user centos
become: true # Run as Root
tasks:
#####################################################
# Format, Partition External Disk, and prepare for Broker Usage
#####################################################
- include_role:
name: solace/solace-exstorage-bootstrap
vars:
# AWS T2 Instances
solace_mount_dev: /dev/xvdc
solace_storage_part: /dev/xvdc1
#------------------------------------------------------------------------------------#
- hosts: ha_sol_primary_nodes
remote_user: centos # login as user centos
become: true # Run as Root
pre_tasks:
- include_vars: vars/common-sol-brokers-vars.yml # Load common variables for the Ansible Tasks and Roles from this file
tasks:
#####################################################
# Create the Solace PubSub Docker compose file, Copy the Solace Image (if needed), Load and Run it
#####################################################
- include_role:
name: solace/solace-broker
vars:
#Determine the current Index on the Ansible Inventory based on the broker public IP via "groups['ha_sol_primary_nodes'].index(inventory_hostname)"
#And use that index to retreive corresponding private IPs for the HA_cluster
container_name: PubSubPrimaryNode
ha_ip_primary: "{{ groups['ha_sol_primary_privateip'][ groups['ha_sol_primary_nodes'].index(inventory_hostname) ] }}" #.index(inventory_hostname) 10.0.0.1
ha_ip_backup: "{{ groups['ha_sol_backup_privateip'][ groups['ha_sol_primary_nodes'].index(inventory_hostname) ] }}"
ha_ip_monitor: "{{ groups['ha_sol_monitor_privateip'][ groups['ha_sol_primary_nodes'].index(inventory_hostname) ] }}"
ha_ip_mate: "{{ groups['ha_sol_backup_privateip'][ groups['ha_sol_primary_nodes'].index(inventory_hostname) ] }}"
ha_password: ha_pwd{{ groups['ha_sol_primary_nodes'].index(inventory_hostname) }} #Add current node Ansible Inventory Index to the HA password
node_role: primary
solace_image_name: solace/solace-pubsub-standard
#------------------------------------------------------------------------------------#
- hosts: ha_sol_backup_nodes
remote_user: centos # login as user centos
become: true # Run as Root
pre_tasks:
- include_vars: vars/common-sol-brokers-vars.yml # Load common variables for the Ansible Tasks and Roles from this file
tasks:
#####################################################
# Create the Solace PubSub Docker compose file, Copy the Solace Image (if needed), Load and Run it
#####################################################
- include_role:
name: solace/solace-broker
vars:
#Determine the current Index on the Ansible Inventory based on the broker public IP via "groups['ha_sol_backup_nodes'].index(inventory_hostname)"
#And use that index to retreive corresponding private IPs for the HA_cluster
container_name: PubSubBackupNode
ha_ip_primary: "{{ groups['ha_sol_primary_privateip'][ groups['ha_sol_backup_nodes'].index(inventory_hostname) ] }}" #.index(inventory_hostname) 10.0.0.1
ha_ip_backup: "{{ groups['ha_sol_backup_privateip'][ groups['ha_sol_backup_nodes'].index(inventory_hostname) ] }}"
ha_ip_monitor: "{{ groups['ha_sol_monitor_privateip'][ groups['ha_sol_backup_nodes'].index(inventory_hostname) ] }}"
ha_ip_mate: "{{ groups['ha_sol_primary_privateip'][ groups['ha_sol_backup_nodes'].index(inventory_hostname) ] }}"
ha_password: ha_pwd{{ groups['ha_sol_backup_nodes'].index(inventory_hostname) }} #Add current node Ansible Inventory Index to the HA password
node_role: backup
solace_image_name: solace/solace-pubsub-standard
#------------------------------------------------------------------------------------#
- hosts: ha_sol_monitor_nodes
remote_user: centos # login as user centos
become: true # Run as Root
pre_tasks:
- include_vars: vars/common-sol-brokers-vars.yml # Load common variables for the Ansible Tasks and Roles from this file
tasks:
#####################################################
# Create the Solace PubSub Docker compose file, Copy the Solace Image (if needed), Load and Run it
#####################################################
- include_role:
name: solace/solace-broker
vars:
#Determine the current Index on the Ansible Inventory based on the broker public IP via "groups['ha_sol_monitor_nodes'].index(inventory_hostname)"
#And use that index to retreive corresponding private IPs for the HA_cluster
container_name: PubSubMonitorNode
ha_ip_primary: "{{ groups['ha_sol_primary_privateip'][ groups['ha_sol_monitor_nodes'].index(inventory_hostname) ] }}" #.index(inventory_hostname) 10.0.0.1
ha_ip_backup: "{{ groups['ha_sol_backup_privateip'][ groups['ha_sol_monitor_nodes'].index(inventory_hostname) ] }}"
ha_ip_monitor: "{{ groups['ha_sol_monitor_privateip'][ groups['ha_sol_monitor_nodes'].index(inventory_hostname) ] }}"
ha_password: ha_pwd{{ groups['ha_sol_monitor_nodes'].index(inventory_hostname) }} #Add current node Ansible Inventory Index to the HA password
node_role: monitor
solace_image_name: solace/solace-pubsub-standard
#------------------------------------------------------------------------------------#
- hosts: sol_brokers
remote_user: centos # login as user centos
become: true # Run as Root
tasks:
#####################################################
# Install performance monitoring tools HTOP, sysstat (iostat)
#####################################################
- include_role:
name: centos/os-bootstrap
#------------------------------------------------------------------------------------#
- hosts: ha_sol_primary_nodes
remote_user: centos # login as user centos
become: true # Run as Root
pre_tasks:
- include_vars: vars/aws-ha-testvpn-sol-brokers-vars.yml # Load file containing Solace configurations to be created on the Solace Brokers
- include_vars: vars/aws-ha-sol-brokers-vars.yml # Load AWS variables for HA Solace Brokers from this file
tasks:
#####################################################
# Ensure that SEMP is ready before sending any SEMP request to the broker
#####################################################
- name: Wait for SEMP to be ready
wait_for:
port: 8080 # default SEMP port
host: "{{ inventory_hostname }}" # Current host on the Ansible inventory
connect_timeout: 5
delay: 10
timeout: 300
#####################################################
# Assert Master Broker, to make sure that Config-Sync is Up
#####################################################
- include_role:
name: solace/semp/assert-master-broker
#####################################################
# Increase the Broker Max-Spool Usage
#####################################################
- include_role:
name: solace/semp/update-broker-spoolsize
#####################################################
# Create a VPN for Testing
#####################################################
- include_role:
name: solace/semp/create-msg-vpn
#####################################################
# Create a Loop that creates all client Profiles defined on the Variables File
#####################################################
- name: Create Client Profiles
block:
- name: Create all defined profiles on Variables File
with_items: "{{ client_profiles }}"
include_role:
name: solace/semp/create-client-profile
vars:
cp: "{{ item }}"
#####################################################
# Create a Loop that creates all the Client Usernames defined on the Variables File
#####################################################
- name: Create Client Usernames
block:
- name: Create Client Usernames
with_items: "{{ client_usernames }}"
include_role:
name: solace/semp/create-client-username
vars:
cu: "{{ item }}"
#####################################################
# Create a Loop that creates all the queues defined on the Variables File
#####################################################
- name: Create Queues
block:
- name: Create all defined queues on Variables File
with_items: "{{ queues }}"
include_role:
name: solace/semp/create-queue
vars:
q: "{{ queue }}"
loop_control:
loop_var: queue
#####################################################
# Create a Loop that creates queue subscription to the topic for each one of the queues defined on the Variables File
#####################################################
- name: Update Queues
block:
- name: Create all defined queues on Variables File
with_subelements:
- "{{ queues | selectattr('subscription_topics', 'defined') | list }}"
- "subscription_topics"
include_role:
name: solace/semp/create-queue-subscription
vars:
q: "{{ item.0.queueName }}"
subscriptionTopic: "{{ item.1 }}"