-
Notifications
You must be signed in to change notification settings - Fork 17
/
create-node.yaml
42 lines (35 loc) · 1.02 KB
/
create-node.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
---
- hosts: "localhost"
vars:
ansible_connection: "local"
ansible_python_interpreter: "python"
tasks:
- command: "tools/generate-hostname.js -n k8s"
register: "hostname"
- set_fact:
hostname: "{{hostname.stdout}}"
- set_fact:
master_host: "{{hostvars[groups['master'][0]]}}"
- file:
path: "tmp"
state: "directory"
- template:
src: "templates/node.yaml.j2"
dest: "tmp/{{hostname}}.yaml"
- command: >
tools/create-droplet.js
--ssh-keys {{do_ssh_keys}}
--region {{do_region}}
--size {{do_node_size}}
--user-data tmp/{{hostname}}.yaml
--namespace k8s
--hostname {{hostname}}
register: "networks"
when: "do_create_droplets is defined and do_create_droplets"
- set_fact:
networks: "{{networks.stdout | from_json}}"
when: "do_create_droplets is defined and do_create_droplets"
- wait_for:
host: "{{networks.public.ip_address}}"
port: 22
when: "do_create_droplets is defined and do_create_droplets"