-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlaunchManagement.yml
35 lines (33 loc) · 1.09 KB
/
launchManagement.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
---
- hosts: localhost # put localhost. We are processing against aws
connection: local # put local. We are processing against aws
gather_facts: False # don't gather facts against localhost
tasks:
- name: Get AMI Image ID for Management
ec2_ami_info:
region: "{{ region }}"
filters:
name: "Check Point*IaaS BYOL*{{ cp_version }}*"
register: amis_mgmt
- name: print Mgmt ami id
vars:
mgmt_ami: >
{{ amis_mgmt.images | selectattr('name', 'defined') | sort(attribute='creation_date') | last }}
debug:
msg: "{{mgmt_ami.image_id}}"
register: mgmt_ami
- name: launche Management
ec2:
region: "{{ region }}"
image: "{{ mgmt_ami.msg }}"
instance_type: "{{ mgmt_hw }}"
private_ip: "{{ mgmt_net1_ip }}"
wait: no
group_id: "{{ security_group_mgmt.group_id }}"
vpc_subnet_id: "{{ subnet1.subnet.id }}"
key_name: "{{ keypairName }}"
assign_public_ip: True
instance_tags:
Name: CP_Management{{ cp_version }}
user_data: "{{ mgmt_user_data }}"
register: MgmtInstance