-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_node_openstack.yaml
41 lines (32 loc) · 1.07 KB
/
deploy_node_openstack.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
- name: Launch a compute instance
hosts: localhost
tasks:
- name: Launch a VM
os_server:
state: present
name: "{{ lookup('env', 'OS_VM_NAME') }}"
image: "{{ lookup('env', 'OS_IMAGE') }}"
key_name: "{{ lookup('env', 'OS_KEY_NAME') }}"
flavor: "{{ lookup('env', 'OS_FLAVOR') }}"
network: "{{ lookup('env', 'OS_NETWORK') }}"
security_groups: "{{ lookup('env', 'OS_SECURITY_GROUP') }}"
availability_zone: nova
auto_ip: no
reuse_ips: no
register: server
- set_fact:
K8S_MASTER_HOST: "{{ server.openstack.private_v4 }}"
- name: Wait for SSH on the Instance
command: >
ssh -i {{ lookup('env', 'OS_KEY_CERT') }} -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@"{{ K8S_MASTER_HOST }}" true
register: result
until: result is success
retries: 30
delay: 10
- name: Add VM to inventory
add_host:
name: "{{ server.openstack.name }}"
groups: node
ansible_host: "{{ K8S_MASTER_HOST }}"
private_ip: "{{ K8S_MASTER_HOST }}"
- import_playbook: deploy_k8s.yaml