-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_up_gce.yml
41 lines (36 loc) · 914 Bytes
/
dev_up_gce.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
---
- hosts: localhost
gather_facts: no
connection: local
vars:
machine_type: n1-standard-1
image: debian-9
zone: europe-west2-a
tasks:
- name: Launch instance
gce:
instance_names: dev
machine_type: "{{ machine_type }}"
image: "{{ image }}"
zone: "{{ zone }}"
metadata: '{"group":"dev_instance", "startup-script": "apt-get update"}'
tags:
- development
state: present
register: gce
- name: Add host to groupname
add_host:
hostname: "{{ item.public_ip }}"
groupname: dev_instance_ip
with_items: "{{ gce.instance_data }}"
- name: Wait for SSH
wait_for:
delay: 1
host: "{{ item.public_ip }}"
port: 22
state: started
timeout: 10
with_items: "{{ gce.instance_data }}"
- hosts: dev_instance_ip
roles:
- baseconfig