-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbigip_aws_awx.yml
39 lines (37 loc) · 1.15 KB
/
bigip_aws_awx.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
- name: Provision ec2 instances based on the environment
hosts: localhost
connection: local
gather_facts: True
vars:
instance_type: t2.large
security_group: sg-00
subnet_id: subnet-00
image: ami-012acc5cdab881a3b
keypair: keypair
region: ap-southeast-2
count: 1
bigip_password: AAAAA
bigip_license: AAAA
tasks:
- name: Update userdata template
template:
src: bigip_aws.j2
dest: bigip_aws.sh
- name: Launch the new EC2 Instance
ec2:
aws_access_key: "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
aws_secret_key: "{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
wait: true
region: "{{ region }}"
keypair: "{{ keypair }}"
count: "{{count}}"
instance_tags: '{"owner":"svk", "Name":"bigip", "boxtype":"bigip"}'
instance_initiated_shutdown_behavior: terminate
vpc_subnet_id: "{{ subnet_id }}"
user_data: "{{ lookup('file', 'bigip_aws.sh') }}"
register: ec2
- debug: var=ec2.instances[0].public_ip
- name: ping to get facts
ping: