Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Deploying to AWS using
Ansible and Magic
Allen Sanabria
• DevOps Engineer, Anki.
• Sysadmin for about 16 years.
• I will automate as much as I possibly can.
What are we talking about today?
• How you can use Ansible to provision an AWS infrastructure on the fly
with out having t...
Tags are how to find all the things.
• At least create the Name tag.
• PLEASE CREATE THE NAME TAG.
• Maybe create a tag fo...
Life without tags 
My reaction every time I see this…
Simple uptime playbook - uptime.yml
dynamic_groups_test.yml part 1
dynamic_groups_test.yml part 2
dynamic_groups_test.yml part 3
Filters, Filters, and more Filters
Before Filters (Hard coding ids and ARNs)
After Filters (Hard coding names) 
Do not hard code ids or ARNs, if you want to
do the following…
• Deploy a new VPC with out using other tools.
• Deploy all...
Example vars/main.yml
Example vars/policies.yml
Organize your roles, for code reusability.
• Use include in your tasks. You do not have to write a story in
main.yaml
• Cr...
Example Role
group_vars/ is your friend 
• Set the baseline settings in
group_vars/all/{{aws_resource}}.yml
• Set the standard service...
Example group_vars
Keep tasks as clean as possible.
main.yml base.yml
Conclusion
• Use AWS Tags. Without tags, you are a lost puppy.
• Ansible Filters are your friends.
• Stop hard coding IDs ...
Ansible Filters
AnsibleFest2016-Deploying-To-AWS
AnsibleFest2016-Deploying-To-AWS
AnsibleFest2016-Deploying-To-AWS
Upcoming SlideShare
Loading in …5
×

AnsibleFest2016-Deploying-To-AWS

1,152 views

Published on

  • Be the first to comment

  • Be the first to like this

AnsibleFest2016-Deploying-To-AWS

  1. 1. Deploying to AWS using Ansible and Magic
  2. 2. Allen Sanabria • DevOps Engineer, Anki. • Sysadmin for about 16 years. • I will automate as much as I possibly can.
  3. 3. What are we talking about today? • How you can use Ansible to provision an AWS infrastructure on the fly with out having to use separate tools. (CloudFormation, Terraform, etc...) • Leveraging Ansible Filters so that you can use names instead of ARN’s (Amazon Resource Identifiers) • Organize your roles and group_vars for code reusability.
  4. 4. Tags are how to find all the things. • At least create the Name tag. • PLEASE CREATE THE NAME TAG. • Maybe create a tag for the following.. • service (super-fast-web-app, file-parser, or what ever you name your apps) • environment (production, development, etc..) • docker_tag
  5. 5. Life without tags 
  6. 6. My reaction every time I see this…
  7. 7. Simple uptime playbook - uptime.yml
  8. 8. dynamic_groups_test.yml part 1
  9. 9. dynamic_groups_test.yml part 2
  10. 10. dynamic_groups_test.yml part 3
  11. 11. Filters, Filters, and more Filters
  12. 12. Before Filters (Hard coding ids and ARNs)
  13. 13. After Filters (Hard coding names) 
  14. 14. Do not hard code ids or ARNs, if you want to do the following… • Deploy a new VPC with out using other tools. • Deploy all of your services and it’s dependencies with one playbook. • Not look in the aws console for that elusive ARN.. • Not pollute your beautiful playbooks with identifiers that do not make any sense.
  15. 15. Example vars/main.yml
  16. 16. Example vars/policies.yml
  17. 17. Organize your roles, for code reusability. • Use include in your tasks. You do not have to write a story in main.yaml • Create a folder in tasks just for your aws resources. You should not have to write the same code over and over again.
  18. 18. Example Role
  19. 19. group_vars/ is your friend  • Set the baseline settings in group_vars/all/{{aws_resource}}.yml • Set the standard service settings in group_vars/services/{{service}}.yml • Override any of the service variables on a per environment basis. group_vars/environments/{{env}}/services/{{service}}.yml
  20. 20. Example group_vars
  21. 21. Keep tasks as clean as possible. main.yml base.yml
  22. 22. Conclusion • Use AWS Tags. Without tags, you are a lost puppy. • Ansible Filters are your friends. • Stop hard coding IDs and ARNs. • Use group_vars/ to your advantage. • Organize your roles for reusability. • Do not write novels in your tasks. • You can view the examples on github https://github.com/linuxdynasty/ansible-examples
  23. 23. Ansible Filters

×