-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall-aerospike.yml
164 lines (135 loc) · 4.67 KB
/
install-aerospike.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
---
- name: Install Aerospike
hosts: "{{ cluster_tag }}"
gather_facts: true
become: yes
remote_user: "{{ os_config['remote_user'] }}"
vars_files:
- vars/cluster-config.yml
- vars/constants.yml
- vars/os-level-config.yml
tasks:
- name: Import configuration properties
include_vars:
dir: vars
- name: Get service facts
service_facts:
- block:
- name: Installation previously completed message
debug:
msg: "Aerospike is already installed - not re-installing"
- meta: end_host
when: hostvars[inventory_hostname].services[aerospike_service_name] is defined
- block:
- debug:
msg: "Aerospike service is not installed - executing install steps"
- block:
- name: If Ubuntu, update package cache
shell: |
sudo apt update
when: operating_system == ubuntu_os
- block:
- name: "stat {{ feature_key_path }}"
local_action: "stat path={{ feature_key_path }}"
become: no
register: feature_key_meta
- name: "Check feature key {{ feature_key_path }} exists"
fail:
msg: "Specified feature key {{ feature_key_path }} not found"
when: not feature_key_meta.stat.exists
when: enterprise
- name: Check whether download exists
stat:
path: "{{ download_path }}"
register: stat_download_path
- name: Download Aerospike {{ 'Enterprise' if enterprise else 'Community' }}, version = {{ aerospike_version }}, distribution = {{ aerospike_distribution }} if not already downloaded
get_url:
url: "{{ download_url }}"
dest: "{{ download_path }}"
when: not stat_download_path.stat.exists
- name: Unpack installer
unarchive:
remote_src: "yes"
src: "{{ download_path }}"
dest: "{{ download_file_dir }}"
list_files: true
register: result
- name: Get install directory
set_fact:
install_directory: "{{ result.files[0] }}"
- name: "Install Aerospike with strong consistency = {{ strong_consistency }}, tls = {{ tls_enabled }}, encryption at rest = {{ encryption_at_rest }}"
command:
chdir: "{{ download_file_dir }}/{{ install_directory }}"
cmd: "{{ download_file_dir }}/{{ install_directory }}/asinstall"
- name: "Create {{ partition_script_name }} script"
template:
src: "assets/{{ partition_script_name }}.j2"
dest: "/tmp/{{ partition_script_name }}"
mode: 0755
- name: "Partition nvme drives"
shell: "/tmp/{{ partition_script_name }}"
- name: aerospike.conf
import_tasks: modules/aerospike-configuration-tasks.yml
- block:
- name: Feature key
copy:
src: "{{ feature_key_path }}"
dest: /etc/aerospike/features.conf
owner: root
group: root
mode: '0644'
when: enterprise
- import_tasks: modules/prometheus-exporter-install.yml
when: monitoring_enabled
# asadm requires python3 & roster set below requires asadm - so need to do install here
- name: Install python3
package:
name:
- python3
state: latest
become: yes
- name: Start Aerospike service
shell:
cmd: "service aerospike start"
- block:
- name: Copy roster set script
template:
src: "assets/strong-consistency/roster-set.sh.j2"
dest: "/tmp/roster-set.sh"
mode: "0755"
- name: "Set roster"
shell: "/tmp/roster-set.sh"
when: strong_consistency
- name: Installation complete message
debug:
msg: "Aerospike install complete"
when: ( hostvars[inventory_hostname].services[aerospike_service_name] is not defined ) or not(hostvars[inventory_hostname].services[aerospike_service_name].state == 'running')
# May not be available as standard - this is the case on GCP
- name: Install sysstat
package:
name:
- sysstat
state: latest
become: yes
- name: Update monitoring if enabled
hosts: "{{ monitoring_tag }}"
gather_facts: true
become: yes
remote_user: "{{ os_config['remote_user'] }}"
vars_files:
- vars/cluster-config.yml
- vars/constants.yml
- vars/os-level-config.yml
tasks:
- name: Import configuration properties
include_vars:
dir: vars
- name: Get service facts
service_facts:
# When Prometheus is installed, we update the config file - might be necessary as we have added nodes
- import_tasks: modules/prometheus-configuration.yml
when: hostvars[inventory_hostname].services[prometheus_service_name] is defined
- name: Restart prometheus
service:
name: prometheus
state: restarted