orchestration with ansible at fedora project

15
Orchestration with Ansible at Fedora Project Aditya Patawari Fedora Ambassador and Contributor to Fedora Infra Cloud and Infra Engineer at BrowserStack.com [email protected] adimania on freenode irc http://blog.adityapatawati.com February 24, 2014 Aditya Patawari Orchestration with Ansible at Fedora Project

Upload: aditya-patawari

Post on 08-May-2015

1.142 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Orchestration with Ansible at Fedora Project

Orchestration with Ansible at Fedora Project

Aditya Patawari

Fedora Ambassador and Contributor to Fedora Infra

Cloud and Infra Engineer at BrowserStack.com

[email protected]

adimania on freenode irc

http://blog.adityapatawati.com

February 24, 2014

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 2: Orchestration with Ansible at Fedora Project

Topics

Challenges faced by a System Administrator

Why scripts fail to scale

Ansible to the Rescue!

Ansible vs Puppet (or Chef)

Ad-Hoc Stuff

Scripted Stuff

No Agent = True Decentralization

Ansible @ Fedora Infra

Contribute @ Fedora Infra

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 3: Orchestration with Ansible at Fedora Project

Challenges Faced By A System Administrator

New servers. New applications. Updates.

Is it a cloud? Is it a colo? Is it a hybrid?

Initial Configuration. Management. Replication.

New joinees. People leaving.

Read Again from first bullet. Essentially ”SyaAd Loop”

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 4: Orchestration with Ansible at Fedora Project

Why Scripts Fail To Scale

Looks Dirty, specially when exceed 1000 lines (50 for perl)

Code repetition multitude of times

Hard to remember the order of execution

Do you like to Document?

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 5: Orchestration with Ansible at Fedora Project

Ansible to the Rescue!

YAML awesomeness

OpenSSH as transport

Parallel-ordered execution

No agent required on servers!

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 6: Orchestration with Ansible at Fedora Project

Ansible vs Puppet (or Chef)

No agent requirement

Based on Python, can run on minimalistic systems like Xen

YAML is lot easier to read

Derived from my experience with Puppet, criticism welcomed

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 7: Orchestration with Ansible at Fedora Project

Ansible Installation And Configuration

yum, apt, pip

If you can ssh, you can run Ansible

Run ad-hoc or scripted commands

Inventory file: hosts

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 8: Orchestration with Ansible at Fedora Project

Inventory file

$ cat /etc/ansible/hosts

[webservers]

web1.example.com

web2.example.com

[databases]

db1.example.com

db2.example.com

[smtp]

web1.example.com

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 9: Orchestration with Ansible at Fedora Project

Ad-Hoc Stuff 1

$ ansible webservers -m ping

web1.example.com | success >> {

"changed": false,

"ping": "pong"

}

web2.example.com | success >> {

"changed": false,

"ping": "pong"

}

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 10: Orchestration with Ansible at Fedora Project

Ad-Hoc Stuff 2

$ ansible all -m command -a ’echo hello’

web1.example.com | success | rc=0 >>

hello

web2.example.com | success | rc=0 >>

hello

db1.example.com | success | rc=0 >>

hello

db2.example.com | success | rc=0 >>

hello

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 11: Orchestration with Ansible at Fedora Project

Scripted Stuff

$ cat sample_playbook.yml

- name: that awesome service

hosts: databases

tasks:

- name: put config

copy: src=config/my.conf dest=/etc/mysql/my.conf

notify:

- restart MySQL

handlers:

- name: restart MySQL

command: service mysqld restart

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 12: Orchestration with Ansible at Fedora Project

No Agent = True Decentralization

Anyone with right authorization can execute

No more ”Damn! Orchestration server went down :(”

One less server to manage

Works from anywhere, anytime

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 13: Orchestration with Ansible at Fedora Project

Ansible @ Fedora Infra

Creating from scratch = easy-peasy, moving from Puppet =”Kill me now!”

Focus on idempotent playbooks

Turbo charged with Accelerate mode

Learn what not to do

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 14: Orchestration with Ansible at Fedora Project

Contribute @ Fedora Infra

Fedora = Bleeding Edge, leading by example

Help us port Puppet modules to Ansible

Easyfix modules for beginners

Lots of helpful people on IRC and mailing list.

Talk to us at #fedora-admin on IRC

Aditya Patawari Orchestration with Ansible at Fedora Project

Page 15: Orchestration with Ansible at Fedora Project

Questions?

Now is your chance :)

Aditya Patawari Orchestration with Ansible at Fedora Project