-
Notifications
You must be signed in to change notification settings - Fork 0
/
1_create_cluster.yaml
73 lines (72 loc) · 2.6 KB
/
1_create_cluster.yaml
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
-
hosts: localhost
vars_files:
- external_vars.yaml
vars:
service_account_content: "{{ lookup('file', gcp_cred_file) }}"
service_account_email: "{{ service_account_content | json_query('client_email') }}"
tags: create
tasks:
-
name: Create a cluster
gcp_container_cluster:
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_cred_file }}"
name: "{{ cluster_name }}"
zone: "{{gcp_zone }}"
initial_node_count: 1
node_config:
machine_type: g1-small
disk_size_gb: 10
register: cluster
-
name: This is the cluster
debug:
var: cluster
-
name: Create the real node pool
gcp_container_node_pool:
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_cred_file }}"
name: "the-real-pool"
zone: "{{gcp_zone }}"
cluster: "{{ cluster }}"
initial_node_count: 3
autoscaling:
enabled: true
min_node_count: 1
max_node_count: 6
config:
machine_type: g1-small
disk_size_gb: 10
preemptible: true
metadata:
disable-legacy-endpoints: "true"
oauth_scopes:
- "https://www.googleapis.com/auth/logging.write"
- "https://www.googleapis.com/auth/monitoring"
- "https://www.googleapis.com/auth/cloud-platform"
service_account: "{{ service_account_email }}"
management:
auto_repair: true
auto_upgrade: false
version:
register: node_pool
-
name: This is the node pool
debug:
var: node_pool
-
name: Delete the implicite node pool
gcp_container_node_pool:
project: "{{ gcp_project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_cred_file }}"
name: "default-pool"
zone: "{{gcp_zone }}"
cluster: "{{ cluster }}"
initial_node_count:
state: absent
# vim: set sw=4 ts=4 et indk= :