Slide 1

Slide 1 text

Ansible and Cloudformation Mark Wolfe DevOps @ Versent

Slide 2

Slide 2 text

Welcome • Who is this guy? • @wolfeidau on twitter and Github • Who is Versent? • Yes we are hiring

Slide 3

Slide 3 text

Overview • Reproducible and supported way to create an environment using a number of resources within an AWS account • Maintain many of these environments in parallel • Update these environments based on changing requirements • Hand over this code to others to maintain

Slide 4

Slide 4 text

kubernetes • Container schedular with lots of amazing features and contributors • Orchestrate Containers across a number of hosts • Requires a bit of infrastructure to bootstrap • VPC to hosts the cluster • etcd cluster • controllers • workers

Slide 5

Slide 5 text

Cloudformation • JSON representation of AWS infrastructure • Not a lot of Logic • Verbose and cumbersome to refactor • Use a DSL • cloudformation-ruby-dsl

Slide 6

Slide 6 text

Cloudformation Layers • Like an onion • Has layers • These layers build a number a resources then output attributes • Subsequent layers build use outputted attributes • Strategies for re-usable CloudFormation Templates

Slide 7

Slide 7 text

Code • Lets review the code

Slide 8

Slide 8 text

Ansible

Slide 9

Slide 9 text

Ansible • Run Cloudformation • Manage different environment configuration • Generate and upload certificates • Executed from CI server • Discover and retrieve attributes / settings from other stacks

Slide 10

Slide 10 text

Cloudformation Module • Build a stack • Discover a stack and retrieve it’s outputs • Export these as facts • Use them in subsequent layers

Slide 11

Slide 11 text

AWS CLI • Ansible used to execute aws CLI tasks such as: • Update Route53 to switch CNAMES during deployments • Generate and store Secrets • unicreds Store secrets using DynamoDB + KMS • Upload UserData bundles to S3 • requirements.yml • playbook.yml

Slide 12

Slide 12 text

CI/CD • Builds environments • Used to manage parameters / environments • Ansible used to perform adhoc automation tasks • Run backup Jobs across a number of hosts using dynamic inventory • Sync data between S3 buckets across accounts and report any issues • Reusable roles used to build these jobs

Slide 13

Slide 13 text

• Decomposed into reusable Roles • docker • etcd • kubernetes controllers • kubernetes workers UserData

Slide 14

Slide 14 text

• Using molecule • makes testing ansible roles really simple • docker • serverspec Testing

Slide 15

Slide 15 text

Questions • Thanks for listening • @wolfeidau on twitter • github.com/wolfeidau • [email protected]

Slide 16

Slide 16 text

References • http://awsadvent.tumblr.com/post/38685647817/ strategies-reusable-cfn-templates • https://github.com/wolfeidau/k8sdev SOON • https://github.com/metacloud/molecule • https://github.com/retr0h/ansible-etcd/blob/master/ Makefile • https://github.com/kelseyhightower/kubernetes-the- hard-way

Slide 17

Slide 17 text

Images • Image from banff collection by TJ Holowaychuk • "Snowstorm" by Beaulawrence