This repository was archived by the owner on Nov 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1-ec2-create.yml
More file actions
45 lines (43 loc) · 1.54 KB
/
Copy path1-ec2-create.yml
File metadata and controls
45 lines (43 loc) · 1.54 KB
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
################################################################################
## ##
## Ansible Tower Playbook ##
## Name: EC2-Create.yml ##
## Created by: Matthew Kimler and Robert Nelson ##
## Website: www.iarchive.com ##
## ##
################################################################################
---
# Basic provisioning example
- name: Create AWS resources
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Create an EC2 instance
ec2:
# aws_access_key: "{{aws_access_key}}"
# aws_secret_key: "{{aws_secret_key}}"
key_name: "{{key_name}}"
region: "{{aws_region}}"
group_id: "{{firewall_group_id}}"
instance_type: "{{instance_type}}"
vpc_subnet_id: "{{vpc_subnet_id}}"
image: "{{ami_id}}"
assign_public_ip: yes
wait: yes
volumes:
- device_name: /dev/sda1
volume_type: gp2
volume_size: 10
delete_on_termination: true
exact_count: "{{ec2_quantity}}"
count_tag:
Env: Demo
instance_tags:
Name: ansible-aws-tower
Project: RHS-Demo
Env: Demo
register: ec2
- name: Wait 20 seconds for AWS deployment
wait_for:
timeout: 20