forked from hortonworks/ansible-hortonworks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_gce.yml
40 lines (37 loc) · 1.23 KB
/
build_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
---
- name: Build the Cloud Environment
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Create the {{ cloud_config.vpc_name }} VPC network
gce_net:
name: "{{ cloud_config.vpc_name }}"
mode: custom
subnet_name: "{{ cloud_config.subnet_name }}"
subnet_region: "{{ cloud_config.region }}"
ipv4_range: "{{ cloud_config.subnet_cidr }}"
- name: Create firewall rules
gce_net:
name: "{{ cloud_config.vpc_name }}"
fwname: "{{ item.name }}"
allowed: "{{ item.allowed }}"
src_range: "{{ item.src_range }}"
target_tags: "{{ item.target_groups|default(omit) }}"
with_items: "{{ firewall_rules }}"
async: 1000
poll: 0
register: current_firewall_rules_async
- name: Wait for firewall rules to be applied
async_status:
jid: "{{ local_loop.ansible_job_id }}"
loop_control:
loop_var: local_loop
with_items: "{{ current_firewall_rules_async.results }}"
register: current_firewall_rules
until: current_firewall_rules.finished
retries: 120
- name: Build GCE Nodes
include_tasks: build_gce_nodes.yml
when: item.count > 0
with_items: "{{ nodes }}"