-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathadd-nodes.yml
executable file
·59 lines (57 loc) · 2.42 KB
/
add-nodes.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
#!/usr/bin/env ansible-playbook
#
# (c) 2017 DataNexus Inc. All Rights Reserved
---
# Build our solr and zookeeper host groups
- name: Create solr and zookeeper host groups
hosts: localhost
gather_facts: no
tasks:
# if we're using dynamic provisioning; build the host groups from the
# meta-data associated with the matching nodes in the selected cloud
- block:
# load the 'local variables file', if one was defined, to get any variables
# we might need from that file when constructing our host groups
- name: Load local variables file
include_vars:
file: "{{local_vars_file}}"
when: not (local_vars_file is undefined or local_vars_file is none or local_vars_file | trim == '')
# then, build our host groups
- include_role:
name: build-app-host-groups
vars:
host_group_list:
- name: solr
- name: zookeeper
when: cloud is defined and (cloud == 'aws' or cloud == 'osp')
# Collect some Zookeeper related facts
- name: Gather facts from Zookeeper host group (if defined)
hosts: zookeeper
tasks: []
# Then, deploy Solr to the new target nodes (i.e. those that don't have a
# fusion service configured on them already) and configure those nodes
# to join the existing cluster
- name: Install/configure Solr server(s)
hosts: solr
gather_facts: no
vars_files:
- vars/solr.yml
vars:
- combined_package_list: "{{ (default_packages|default([])) | union(solr_package_list) | union((install_packages_by_tag|default({})).solr|default([])) }}"
- solr_nodes: "{{groups['solr']}}"
- zookeeper_nodes: "{{groups['zookeeper']}}"
pre_tasks:
# first, initialize the play by loading any `local_vars_file` that may have
# been passed in, restarting the network on the target nodes (if desired),
# and determining the `data_iface` and `api_iface` values from the input
# `iface_description_array` (if one was passed in)
- include_role:
name: initialize-play
# and now that we know the name of our `data_iface`, we can construct the
# list of zk_nodes (the data_iface IP addresses of our zookeeper_nodes)
- set_fact:
zk_nodes: "{{(zookeeper_nodes | default([])) | map('extract', hostvars, [('ansible_' + data_iface), 'ipv4', 'address']) | list}}"
# now that we have all of the facts we need, add the new nodes to the cluster
roles:
- role: add-nodes
service_deployed: fusion