-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaerospike-java-client-setup.yml
188 lines (158 loc) · 5.6 KB
/
aerospike-java-client-setup.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
---
- name: Create an Aerospike client instance
hosts: local
connection: local
gather_facts: no
vars:
instance_tag: "{{ client_tag }}"
instance_count: "{{ aerospike_client_per_az_count }}"
instance_function: client
az_list : "{{ client_az_list }}"
instance_type: "{{ client_instance_type }}"
tasks:
- name: Import configuration properties
include_vars:
dir: vars
- name: "Setup {{ instance_function }} instance vars"
include_vars: modules/instance-setup-vars.yml
- name: "Setup {{ instance_function }} instances"
import_tasks: modules/instance-setup.yml
- name: Get cluster instance info
ec2_instance_info:
region: "{{ aws_region }}"
filters:
instance-state-name: [ "pending", "running" ]
"tag:group": "{{ cluster_tag }}"
register: cluster_info
- name: Cache cluster ip address for use in benchmarking scripts
set_fact:
cluster_node_ip: "{{ cluster_info.instances[0].private_ip_address }}"
cacheable: yes
- meta: refresh_inventory
- name: Set up benchmarking
hosts: "{{ client_tag }}"
gather_facts: true
become: no
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
- block:
- name: If Ubuntu, update package cache
shell: |
set -e
sudo apt update
- name: If Ubuntu remove existing Java - there's a compatibility issue with 11 and our client at present
package:
name:
- "*openjdk*11*"
state: absent
become: yes
when: operating_system == ubuntu_os
- name: Install Java/git/sysstat/screen
package:
name:
- "{{ os_config['java_package_name'] }}"
- git
- sysstat
- screen
state: present
become: yes
# At the time of writing, Aerospike Java client needs 3.1.1 maven to build, but yum only provides 3.0
- name: Get Maven
shell: |
set -e
cd {{ ansible_env.HOME }}
wget https://dlcdn.apache.org/maven/maven-3/{{ maven_version }}/binaries/apache-maven-{{ maven_version }}-bin.tar.gz
tar xvfz apache-maven-{{ maven_version }}-bin.tar.gz
- name: Install Aerospike Java Client
git:
clone: "yes"
dest: "{{ ansible_env.HOME }}/aerospike-client-java"
repo: "https://github.com/aerospike/aerospike-client-java.git"
- name: Retrieve cluster ip for use in benchmarking scripts
set_fact:
cluster_node_ip: "{{ hostvars['localhost'].cluster_node_ip }}"
- name: Build Aerospike Java Client
shell: |
set -e
cd {{ ansible_env.HOME }}/aerospike-client-java
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
echo "export PATH={{ ansible_env.HOME }}/apache-maven-{{ maven_version }}/bin:\$PATH" >> {{ ansible_env.HOME }}/.bash_profile
source {{ ansible_env.HOME }}/.bash_profile
{{ ansible_env.HOME }}/aerospike-client-java/build_all
- name: "Copy benchmarking config to client"
template:
src: "assets/benchmarking/as-benchmark-common.sh.j2"
dest: "{{ ansible_env.HOME }}/aerospike-client-java/benchmarks/as-benchmark-common.sh"
force: yes
mode: 0755
- name: "Copy benchmarking scripts to client"
copy:
src: "assets/benchmarking/{{ item }}"
dest: "{{ ansible_env.HOME }}/aerospike-client-java/benchmarks/{{ item }}"
mode: 0755
with_items:
- "as-benchmark-w.sh"
- "as-benchmark-rw.sh"
- name: Install asloader
git:
clone: "yes"
dest: "{{ ansible_env.HOME }}/aerospike-loader"
repo: "https://github.com/aerospike/aerospike-loader.git"
- name: Build asloader
shell: |
cd {{ ansible_env.HOME }}/aerospike-loader
source {{ ansible_env.HOME }}/.bash_profile
{{ ansible_env.HOME }}/aerospike-loader/build
# Install tools
- name: Check whether download exists
stat:
path: "{{ download_path }}"
register: stat_download_path
- name: Download Aerospike Tools if not already downloaded
get_url:
url: "{{ tools_download_url }}"
dest: "{{ tools_download_path }}"
when: not stat_download_path.stat.exists
- name: Unpack installer
unarchive:
remote_src: "yes"
src: "{{ tools_download_path }}"
dest: "{{ tools_download_file_dir }}"
list_files: true
register: result
- name: Get install directory
set_fact:
install_directory: "{{ result.files[0] }}"
- name: "Install Aerospike Tools version {{ aerospike_tools_version }}"
become: yes
command:
chdir: "{{ tools_download_file_dir }}/{{ install_directory }}"
cmd: "{{ tools_download_file_dir }}/{{ install_directory }}/asinstall"
- block:
- name: Copy CA cert to client host temporary directory
copy:
src: "{{ local_certs_directory }}/ca.crt"
dest: "{{ temp_directory }}"
mode: 0644
- name: Import CA cert to key store
shell: |
set -e
JAVA_HOME=$(dirname $(dirname $(dirname $(readlink -f $(which java)))))
# Remove without error if already exists
set +e
keytool -delete -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias aerospike_ansible
set -e
keytool -import -noprompt -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias aerospike_ansible -import -file {{ temp_directory}}/ca.crt
become: yes
- name: Remove CA from temporary directory
file:
path: "{{ temp_directory }}/ca.crt"
state: absent
when: tls_enabled