-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
37 lines (34 loc) · 1005 Bytes
/
main.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
- name: Provision Bot
hosts: localhost
gather_facts: False
tasks:
- name: Provision an EC2 instance with a public IP address
amazon.aws.ec2_instance:
name: TripleA Bot
aws_profile: default
key_name: triplea
vpc_subnet_id: subnet-b25c3afe
instance_type: t4g.micro
security_group: TripleA
network:
assign_public_ip: true
image_id: ami-0ff596d41505819fd
region: us-east-2
register: result
- name: Add all instance public IPs to host group
add_host: hostname={{ item.public_ip_address }} groups=ec2hosts
loop: "{{ result.instances }}"
- hosts: ec2hosts
name: configuration play
become: yes
user: "{{ admin_user }}"
gather_facts: true
vars:
ansible_ssh_private_key_file: "~/.ssh/triplea.pem"
roles:
- system/apt_update
- system/apt_common_tools
- system/journald
- java
- bot
# need a reboot step for the instance after system updates. Separate role?