Additional Stack Information - Alex-Burgess/ansible-demo GitHub Wiki
Ongoing review
Overview of key base stack params file
- Image ID: Specify AMI for region.
- Instance Type: Specify EC2 instance type.
- Purchase Option: Specify Spot or OnDemand. The bid price can be adjusted in SpotPrice.
- Ansible Controller Environments: By default the Test environment is always built. To build Standing and Prod, update BuildProd, BuildStaging by Specify true or false.
- Number of Ansible Controllers: To specify the number of Ansible controller instances update TestAnsibleControllerDesiredCapacity, StagingAnsibleControllerDesiredCapacity, ProdAnsibleControllerDesiredCapacity.
Overview of webservers stack params file
- As in the base stack, Image ID, Instance Type and Spot parameters are configurable.
- Web App Name: The web app name must match the names of the Web applications already defined in the project structure (i.e. /webapps/webappname/...)
- Base Stack Name: Can be updated to the name of a different base stack.
- Number of Webservers: Specify number of webserver instances in the WebserverDesiredCapacity.
Update stack
To update a stack:
$ aws cloudformation update-stack \
--stack-name anisbledemo \
--template-url https://s3.amazonaws.com/ansible-hello-world/cloudformation/main.template \
--parameters file://params_demo.json \
--capabilities CAPABILITY_NAMED_IAM
Note, the stack builds instances using instance userdata and metadata. If you are unfamiliar with cfn helper scripts see the following walkthrough for a guide Updating Stacks Walkthrough.
Delete Stack
To delete the stack:
$ aws cloudformation delete-stack --stack-name anisbledemo
Build an environment stack for testing:
description:
$ aws cloudformation create-stack --stack-name testAcStack \
--template-body file://environment.template \
--parameters ParameterKey=InstanceKeyName,ParameterValue=AlexMain \
ParameterKey=InstanceProfileName,ParameterValue=DescribeEC2TagsInstanceProfile \
ParameterKey=ImageID,ParameterValue=ami-xxxxxx \
ParameterKey=SecurityGroupIDs,ParameterValue="sg-xxxxxx " \
ParameterKey=SubnetIDs,ParameterValue="subnet-xxxxxx\,subnet-xxxxxx\,subnet-xxxxxx" \
ParameterKey=AppName,ParameterValue=TestAnsibleController