This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-openstack.yml
80 lines (73 loc) · 2 KB
/
playbook-openstack.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
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
74
75
76
77
78
79
80
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Create security groups
os_security_group:
cloud: betacloud
name: "{{ item.key }}"
with_dict: "{{ security_group_rules }}"
- name: Create security group rules
os_security_group_rule:
cloud: betacloud
security_group: "{{ item.key }}"
protocol: "{{ item.value.proto | default(omit) }}"
port_range_min: "{{ item.value.port | default(omit) }}"
port_range_max: "{{ item.value.port | default(omit) }}"
remote_ip_prefix: "{{ item.value.cidr | default(omit) }}"
with_dict: "{{ security_group_rules }}"
- name: Create keypair
os_keypair:
cloud: betacloud
name: infrastructure
register: keypair
- name: Persist the keypair
copy:
dest: secrets/id_rsa
content: "{{ keypair.key.private_key }}"
mode: 0600
when: keypair.changed
- name: Create bastion instance
os_server:
cloud: betacloud
name: "bastion"
flavor: 1C-1GB-10GB
image: "Ubuntu 16.04 (Xenial Xerus)"
security_groups:
- bastion
key_name: infrastructure
floating_ip_pools: public
delete_fip: yes
meta: "groups=bastion"
state: present
- name: Create internal docker instances
os_server:
cloud: betacloud
name: "docker-internal-{{ item }}"
flavor: 2C-4GB-10GB
image: "Ubuntu 16.04 (Xenial Xerus)"
security_groups:
- internal
key_name: infrastructure
auto_ip: no
meta: "groups=internal"
state: present
with_items:
- 8493ed8dd732
- 01239919dfa1
- name: Create external docker instances
os_server:
cloud: betacloud
name: "docker-external-{{ item }}"
flavor: 2C-4GB-10GB
image: "Ubuntu 16.04 (Xenial Xerus)"
security_groups:
- external
key_name: infrastructure
floating_ip_pools: public
delete_fip: yes
meta: "groups=external"
state: present
with_items:
- 12f1143cdd61