Slide 1

Slide 1 text

Migrating from another configuration management system Robby Colvin @geetarista

Slide 2

Slide 2 text

$ whoami

Slide 3

Slide 3 text

About Me • Work @ Kiip • Software Engineer • Operations Engineer • Engineer

Slide 4

Slide 4 text

$ cat /etc/passwd | grep audience

Slide 5

Slide 5 text

Why choose Ansible?

Slide 6

Slide 6 text

Why choose Ansible? • Application Deployment • Cloud-aware orchestration • Ad-hoc tasks • Low barrier to entry stack-wise • Simple for developers to grasp • Python + Boto • No central server required • Flexibility

Slide 7

Slide 7 text

Is it right for you?

Slide 8

Slide 8 text

Is it right for you? • Is it cost-effective? • Does it fit your culture? • Does it align with your goals? • Can you abandon your current tooling? • Does it improve productivity?

Slide 9

Slide 9 text

Ansible 101

Slide 10

Slide 10 text

Ansible 101 • YAML • Jinja2 • Hosts • Roles • Playbooks • CLI • Modules

Slide 11

Slide 11 text

Modules • Builtin • EC2, DigitalOcean, Rackspace, Linode, et. al. • Commands • Databases • Files/Templates • Packages • Etc.

Slide 12

Slide 12 text

Migration Plan

Slide 13

Slide 13 text

Migration Plan 1. Get your feet wet 2. Plan/organize 3. Execute

Slide 14

Slide 14 text

Get Your Feet Wet

Slide 15

Slide 15 text

Get Your Feet Wet • Several options to start with Ansible

Slide 16

Slide 16 text

Get Your Feet Wet • Several options to start with Ansible • Risk free™

Slide 17

Slide 17 text

Get Your Feet Wet • Several options to start with Ansible • Risk free™ • Pick a simple role

Slide 18

Slide 18 text

Get Your Feet Wet • Several options to start with Ansible • Risk free™ • Pick a simple role • Take baby steps

Slide 19

Slide 19 text

Get Your Feet Wet • Several options to start with Ansible • Risk free™ • Pick a simple role • Take baby steps • Simple Module(s)

Slide 20

Slide 20 text

Get Your Feet Wet • Several options to start with Ansible • Risk free™ • Pick a simple role • Take baby steps • Simple Module(s) • Build on what you learn

Slide 21

Slide 21 text

Install Ansible • pip install ansible • Others: apt, yum, source

Slide 22

Slide 22 text

Configure # ansible.cfg [defaults] hostfile = production.ini private_key_file = production.pem remote_user = ubuntu sudo = True [ssh_connection] scp_if_ssh = True

Slide 23

Slide 23 text

Existing Boxes

Slide 24

Slide 24 text

Existing Boxes • CLI • --check --diff • Push from your machine • Run simple modules: ping, setup, etc. • Move on to other modules

Slide 25

Slide 25 text

Vagrant

Slide 26

Slide 26 text

Vagrant • Run from your machine to Vagrant host • Use Ansible provisioner • Go crazy • Simulate multiple hosts, clusters, etc.

Slide 27

Slide 27 text

Vagrant Ansible provisioner Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.provision "ansible" do |ansible| ansible.playbook = "vagrant.yml" end end

Slide 28

Slide 28 text

Ansible Vagrant host Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.network :private_network, ip: "192.168.33.10" end

Slide 29

Slide 29 text

Ansible Vagrant host # vagrant.ini 192.168.33.10 \ ansible_ssh_user = vagrant \ ansible_ssh_private_key_file = \ ~/.vagrant.d/insecure_private_key

Slide 30

Slide 30 text

Moving Forward

Slide 31

Slide 31 text

Plan

Slide 32

Slide 32 text

Take stock • Identify existing cruft • Get to know Ansible modules (don't re-invent the wheel) • Identify custom modules to be written • Integrate with infrastructure • Get to know the documentation • Learn how to use the CLI • Learn how to write Jinja2 templates

Slide 33

Slide 33 text

Organize • Host inventory

Slide 34

Slide 34 text

Host Inventory • Write inventory by hand • Use ec2.py • Write your own inventory script

Slide 35

Slide 35 text

Hosts # hosts.ini [production] 10.1.100.1 10.1.100.2 [staging] 10.2.100.1

Slide 36

Slide 36 text

Organize • Host inventory • Roles

Slide 37

Slide 37 text

Roles roles/ nginx/ files/ handlers/ library/ tasks/ templates/ vars/

Slide 38

Slide 38 text

Organize • Host inventory • Roles • Playbooks

Slide 39

Slide 39 text

Playbooks • Top-level • Include other playbooks • Node definitions

Slide 40

Slide 40 text

Playbooks --- - hosts: web roles: - common - nginx - postgresql

Slide 41

Slide 41 text

Organize • Host inventory • Roles • Playbooks • Choose a mode

Slide 42

Slide 42 text

Choose a Mode • Push • Pull • Manager (API)

Slide 43

Slide 43 text

Start the rewrite

Slide 44

Slide 44 text

Start the rewrite • Baby steps: one role at a time

Slide 45

Slide 45 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff

Slide 46

Slide 46 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff • Test against staging or box outside LB

Slide 47

Slide 47 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff • Test against staging or box outside LB • Vagrant

Slide 48

Slide 48 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff • Test against staging or box outside LB • Vagrant • Write new roles/playbooks in ansible

Slide 49

Slide 49 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff • Test against staging or box outside LB • Vagrant • Write new roles/playbooks in ansible • Get everyone involved

Slide 50

Slide 50 text

Start the rewrite • Baby steps: one role at a time • Use --check --diff • Test against staging or box outside LB • Vagrant • Write new roles/playbooks in ansible • Get everyone involved • Stay up to date with documentation

Slide 51

Slide 51 text

Last Steps

Slide 52

Slide 52 text

NONE! • If done properly, you should be good to go • Just iterate and continue forward • Move on to advanced topics

Slide 53

Slide 53 text

Questions

Slide 54

Slide 54 text

Thanks! @geetarista