-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-app.yml
40 lines (34 loc) · 987 Bytes
/
deploy-app.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
- name: Create instances
hosts: localhost
connection: local
gather_facts: no
vars:
service_account_email: ---
credentials_file: file.json
project_id: ---
machine_type: n1-standard-1
image: ubuntu-1604
tasks:
- name: Launch application instances
gce:
instance_names: app
machine_type: "{{ machine_type }}"
image: "{{ image }}"
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
tags: app
preemptible: true
register: gce
- name: Wait for SSH
wait_for: host={{ item.public_ip }} port=22 delay=10 timeout=360
loop: "{{ gce.instance_data }}"
- name: Add host to group
add_host: hostname={{ item.public_ip }} groupname=appservers
loop: "{{ gce.instance_data }}"
- name: Provision app servers
hosts: appservers
connection: ssh
sudo: True
roles:
- counter-app