-
Notifications
You must be signed in to change notification settings - Fork 4
/
clc-kubernetes-node.yml
39 lines (34 loc) · 1.11 KB
/
clc-kubernetes-node.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
- hosts: localhost
tasks:
- name: Generate server root password
command: openssl rand -base64 15
register: server_pass
- name: Set server password fact.
set_fact:
server_pass: "{{ server_pass.stdout }}"
- name: Create new kubernetes server for node deployment.
clc_server:
name: "{{ name }}"
location: "{{ datacenter }}"
template: ubuntu-14-64
password: "{{ server_pass }}"
count: 1
group: "{{ group }}"
network_id: "{{ network_id }}"
cpu: 4
memory: 8
type: standard
storage_type: standard
register: new_inv
- name: Add new servers to in-memory inventory.
add_host:
name={{ item.name }}
ansible_ssh_host={{ item.ipaddress }}
ansible_ssh_user=root
ansible_ssh_pass={{ server_pass }}
groups=node
with_items: new_inv.servers
- name: Wait for SSH process.
wait_for: host={{ item.ipaddress }} port=22 delay=5 timeout=320 state=started
with_flattened: new_inv.servers
- include: kubernetes-node.yml hosts=node