-
Notifications
You must be signed in to change notification settings - Fork 3
/
k8-create-infra.yml
executable file
·49 lines (49 loc) · 1.27 KB
/
k8-create-infra.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
---
- name: Create Infra for K8-cluster
hosts: localhost
gather_facts: False
vars:
keypair: aws-key
instance_type: t2.micro
security_group: default
image: ami-0eb89db7593b5d434
region: eu-west-2
subnet: subnet-082213e51ccfdcaa4
tasks:
- name: Launch master instance
ec2:
count: 1
key_name: "{{ keypair }}"
group: "{{ security_group }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
instance_tags:
Name: Devops-Master-{{item}}
environment: ops
node_type: master
wait: true
region: "{{ region }}"
vpc_subnet_id: "{{ subnet }}"
assign_public_ip: yes
register: ec2
with_items:
- 1
- name: Launch node instance
ec2:
count: 2
key_name: "{{ keypair }}"
group: "{{ security_group }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
instance_tags:
Name: Devops-Node-{{item}}
environment: ops
node_type: node
wait: true
region: "{{ region }}"
vpc_subnet_id: "{{ subnet }}"
assign_public_ip: yes
register: ec2
with_items:
- 1
- 2