-
Notifications
You must be signed in to change notification settings - Fork 0
/
elasticsearch_gce_provision.yml
54 lines (46 loc) · 1.47 KB
/
elasticsearch_gce_provision.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
# Launch instances from a control node, runs some tasks on the new instances,
# and then terminate them
- name: Create instance(s)
hosts: localhost
connection: local
gather_facts: no
vars:
service_account_email: 314151147552-b1ii5ltn8i7qh9c9mig4ef8l7skuhleu@developer.gserviceaccount.com
pem_file: /Users/tongqingqiu/Documents/Projects/Puppet/Beaker/gce/pkey.pem
project_id: compact-scene-578
machine_type: n1-standard-1
image: centos-6
host_names:
- dev1
- dev2
- dev3
elasticsearch_discovery_zen_ping_unicast_hosts:
- dev1
- dev2
- dev3
tasks:
- name: Launch instances
gce:
instance_names: "{{host_names}}"
machine_type: "{{ machine_type }}"
image: "{{ image }}"
service_account_email: "{{ service_account_email }}"
pem_file: "{{ pem_file }}"
project_id: "{{ project_id }}"
tags: webserver
register: gce
- debug: var=gce
- name: Wait for SSH to come up
wait_for: host={{ item.public_ip }} port=22 delay=10 timeout=60
with_items: gce.instance_data
# add host to group 'just_created' with variable
- add_host: hostname={{ item.public_ip }} groupname=elasticsearchservers_gce
with_items: gce.instance_data
- name: Install Elasticsearch
hosts: elasticsearchservers_gce
remote_user: google_compute
sudo: True
connection: ssh
roles:
- common
- elasticsearch