-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgce-provision.yml
43 lines (42 loc) · 1.88 KB
/
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
#
# Create storage nodes and volumes
#
- name: Create storage nodes and volumes
any_errors_fatal: true
hosts: localhost
connection: local
vars_files:
- "vars/{{ varfile }}"
vars:
- type: "storage"
- gce_machine_type: "{{ gce_storage_server_machine_type }}"
- existing_server_names: "{{ groups['tag_type-' + type] | default([]) | intersect( groups['tag_cluster-' + cluster_prefix] | default([]) ) }}"
- new_server_names: |
{% for s in range(0, storage_servers_count - existing_server_names | length ) -%}
{{ cluster_prefix }}-{{ type }}-{{ ( s ~ type ~ ansible_date_time.iso8601_micro ) | hash('sha1')|string | truncate(6, false, '')}}{% if not loop.last %},{% endif %}
{%- endfor %}
- server_names: "{{ existing_server_names | union(new_server_names.strip().split(',')) }}"
roles:
- python-modules
- { role: gce-instances, gce_tags: [ "type-{{ type }}", "cluster-{{ cluster_prefix }}" ] }
- gce-disks
#
# Create standalone storage clients
#
- name: Create standalone storage clients
any_errors_fatal: true
hosts: localhost
connection: local
vars_files:
- "vars/{{ varfile }}"
vars:
- type: "storage-client"
- gce_machine_type: "{{ gce_client_server_machine_type }}"
- existing_server_names: "{{ groups['tag_type-' + type] | default([]) | intersect( groups['tag_cluster-' + cluster_prefix] | default([]) ) }}"
- new_server_names: |
{% for s in range(0, client_servers_count - existing_server_names | length ) -%}
{{ cluster_prefix }}-{{ type }}-{{ ( s ~ type ~ ansible_date_time.iso8601_micro ) | hash('sha1')|string | truncate(6, false, '')}}{% if not loop.last %},{% endif %}
{%- endfor %}
- server_names: "{{ existing_server_names | union(new_server_names.strip().split(',')) }}"
roles:
- { role: gce-instances, gce_tags: [ "type-{{ type }}", "cluster-{{ cluster_prefix }}" ] }