mirror of
https://github.com/trailofbits/algo
synced 2024-11-10 01:11:07 +00:00
proper cloudformation template (#815)
This commit is contained in:
parent
02427910de
commit
7e07c35474
@ -1,13 +1,19 @@
|
||||
---
|
||||
|
||||
AWSTemplateFormatVersion: '2010-09-09'
|
||||
Description: 'Algo VPN stack'
|
||||
Parameters:
|
||||
InstanceTypeParameter:
|
||||
Type: String
|
||||
Default: t2.micro
|
||||
PublicSSHKeyParameter:
|
||||
Type: String
|
||||
ImageIdParameter:
|
||||
Type: String
|
||||
Resources:
|
||||
|
||||
VPC:
|
||||
Type: AWS::EC2::VPC
|
||||
Properties:
|
||||
CidrBlock: {{ ec2_vpc_nets.cidr_block }}
|
||||
CidrBlock: 172.16.0.0/16
|
||||
EnableDnsSupport: true
|
||||
EnableDnsHostnames: true
|
||||
InstanceTenancy: default
|
||||
@ -35,7 +41,7 @@ Resources:
|
||||
Subnet:
|
||||
Type: AWS::EC2::Subnet
|
||||
Properties:
|
||||
CidrBlock: {{ ec2_vpc_nets.subnet_cidr }}
|
||||
CidrBlock: 172.16.254.0/23
|
||||
MapPublicIpOnLaunch: false
|
||||
Tags:
|
||||
- Key: Environment
|
||||
@ -148,16 +154,19 @@ Resources:
|
||||
homeDir: "/home/ubuntu/"
|
||||
files:
|
||||
/home/ubuntu/.ssh/authorized_keys:
|
||||
content: {{ lookup('file', SSH_keys.public) }}
|
||||
content:
|
||||
Ref: PublicSSHKeyParameter
|
||||
mode: "000644"
|
||||
owner: "ubuntu"
|
||||
group: "ubuntu"
|
||||
Properties:
|
||||
InstanceType: {{ cloud_providers.ec2.size }}
|
||||
InstanceType:
|
||||
Ref: InstanceTypeParameter
|
||||
InstanceInitiatedShutdownBehavior: terminate
|
||||
SecurityGroupIds:
|
||||
- Ref: InstanceSecurityGroup
|
||||
ImageId: {{ ami_image }}
|
||||
ImageId:
|
||||
Ref: ImageIdParameter
|
||||
SubnetId: !Ref Subnet
|
||||
Ipv6AddressCount: 1
|
||||
UserData:
|
||||
@ -176,8 +185,8 @@ Resources:
|
||||
apt-get update
|
||||
apt-get -y install python-setuptools
|
||||
easy_install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
|
||||
cfn-init -v --stack {{ stack_name }} --resource EC2Instance --region {{ region }}
|
||||
cfn-signal -e $? --stack {{ stack_name }} --resource EC2Instance --region {{ region }}
|
||||
cfn-init -v --stack ${AWS::StackName} --resource EC2Instance --region ${AWS::Region}
|
||||
cfn-signal -e $? --stack ${AWS::StackName} --resource EC2Instance --region ${AWS::Region}
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: Algo
|
@ -1,10 +1,4 @@
|
||||
---
|
||||
|
||||
- name: Make a cloudformation template
|
||||
template:
|
||||
src: stack.yml.j2
|
||||
dest: "configs/{{ aws_server_name }}.yml"
|
||||
|
||||
- name: Deploy the template
|
||||
cloudformation:
|
||||
aws_access_key: "{{ aws_access_key | default(lookup('env','AWS_ACCESS_KEY_ID'), true)}}"
|
||||
@ -12,7 +6,11 @@
|
||||
stack_name: "{{ stack_name }}"
|
||||
state: "present"
|
||||
region: "{{ region }}"
|
||||
template: "configs/{{ aws_server_name }}.yml"
|
||||
template: roles/cloud-ec2/files/stack.yml
|
||||
template_parameters:
|
||||
InstanceTypeParameter: "{{ cloud_providers.ec2.size }}"
|
||||
PublicSSHKeyParameter: "{{ lookup('file', SSH_keys.public) }}"
|
||||
ImageIdParameter: "{{ ami_image }}"
|
||||
tags:
|
||||
Environment: Algo
|
||||
register: stack
|
||||
register: stack
|
||||
|
Loading…
Reference in New Issue
Block a user