enn with - i t.a.k.e. (un) confitakeunconf.com/.../automate-all-things-aws-with-ansible.pdfaws with...

Post on 19-Jul-2020

55 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Automate all the things

AWS with Ansible

Philipp Krenn@

xeraa

Infrastructure | Developer Advocate

AgendaAW

S & Ansible basicsAW

S & Ansible in action

While we're getting started

USB Stick

Once upon a time

Handcrafting

It workedsort of...

Root Loginhttps://console.aws.am

azon.comDem

o

Doing it right

PetsvsCattle

AWS

AWS CloudForm

ationTerraform

http://charity.wtf/2016/02/23/two-weeks-with-terraform/

SystemChef, Puppet, Ansible,

Saltstack,...

One tool

AnsibleInventoryPlaybookRole

Boto

USB stickVirtualBox

Box

VirtualBoxW

indows, Mac: USB stickLinux

https://www.virtualbox.org/wiki/Linux_Downloads

BoxVagrant Ansible

Provisioner

But how?Vagrant

Ansible Provisioner

Credentialsvagrantvagrant

SSH$ ssh vagrant@127.0.0.1 -p 2222 -o PreferredAuthentications=password

Test$ ansible --version

Create a VPC in Frankfurtplaybooks/0_vpc-create.yml

inventorygroup_vars/all.yml

ChangeIn group_vars/all.yml myname

Run the playbook$ ansible-playbook playbooks/0_vpc-

create.yml

If it fails

Check your firewallCheck your tim

e

Security Groupsplaybooks/1_security-groups.yml

Run the playbook$ ansible-playbook playbooks/1_security-

groups.yml

Create a Key Pairplaybooks/2_generate-key.yml

Run the playbook$ ansible-playbook playbooks/2_generate-

key.yml

Create an instanceplaybooks/3_instance-create.yml and role

Run the playbook$ ansible-playbook playbooks/3_instance-

create.yml

Find the dns_name in the output

Something like ec2-52-29-131-72.eu-

central-1.compute.amazonaws.com

SSH into the instancessh ubuntu@ec2-52-29-131-72.eu-

central-1.compute.amazonaws.com -i ~/.ssh/id_rsa

SSH into the instance$ ssh ec2-52-29-131-72.eu-

central-1.compute.amazonaws.com -F ssh.config

Change the DNS in your inventory file[first]ec2-52-29-131-72.eu-central-1.compute.amazonaws.com

Provision your instanceplaybooks/4_instance-configure.yml

Run the playbook$ ansible-playbook playbooks/4_instance-

configure.yml

Access the instanceec2-52-29-131-72.eu-

central-1.compute.am

azonaws.com

Ansible-Vault$ ansible-vault

Check & Lintcheck-playbook.sh

https://cloudcraft.co

ConclusionAW

S & Ansible basicsAW

S & Ansible in action

Thanks!Questions?

@xeraa

top related