Skip to content

Instantly share code, notes, and snippets.

@filipenf
Created October 25, 2016 21:30
Show Gist options
  • Save filipenf/702bef009dd23f8ca9544ad30e1f9491 to your computer and use it in GitHub Desktop.
Save filipenf/702bef009dd23f8ca9544ad30e1f9491 to your computer and use it in GitHub Desktop.
- hosts: localhost
connection: local
gather_facts: false
vars:
region: us-east-1
version: 1.0
repository: ansible-deploy-test
server_type: todo
subnet_id: subnet-f7e20b80
key_name: ffelisbino
tasks:
- name: create security group
local_action:
module: ec2_group
name: "todo-sg"
description: ToDO SG
region: "{{ region }}"
rules_egress:
- proto: all
from_port: -1
to_port: -1
cidr_ip: 0.0.0.0/0
rules:
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
- name: "Create a ToDo webserver instance"
local_action:
module: ec2
region: "{{ region }}"
instance_type: t2.micro
image: ami-c481fad3
group: todo-sg
assign_public_ip: yes
key_name: "{{ key_name }}"
vpc_subnet_id: "{{ subnet_id }}"
instance_tags:
Name: "todo-appserver-{{ version }}"
user_data: "{{ lookup('template', 'userdata.sh.j2') }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment