-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbigip_aws.yml
47 lines (45 loc) · 1.36 KB
/
bigip_aws.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
- name: Provision ec2 instances based on the environment
hosts: localhost
connection: local
gather_facts: True
vars_files:
- roles/ec2/vars/aws_creds.yml
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: "{{ ec2_access_key }}"
aws_secret_key: "{{ ec2_secret_key }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
wait: true
region: "{{ region }}"
keypair: "{{ keypair }}"
count: "{{count}}"
instance_tags: '{"owner":"svk", "Name":"bigip"}'
instance_initiated_shutdown_behavior: terminate
vpc_subnet_id: "{{ subnet_id }}"
user_data: "{{ lookup('file', 'bigip_aws.sh') }}"
#user_data: |
# #!/bin/sh
# dnf -y install wget
register: ec2
- debug: var=ec2.instances[0].public_ip
- name: Wait for machines to come up completely
wait_for: host={{ item.public_ip }} port=22
with_items: '{{ec2.instances}}'
- name: ping to get facts
ping: