Ansible Wechat Account Ansible Meetup Shanghai August 17th - - PowerPoint PPT Presentation

ansible wechat account ansible meetup shanghai august
SMART_READER_LITE
LIVE PREVIEW

Ansible Wechat Account Ansible Meetup Shanghai August 17th - - PowerPoint PPT Presentation

Ansible Wechat Account Ansible Meetup Shanghai August 17th ansible.com wiredcraft.com Introduction What is Ansible? Ansible.com Gaining momentum Ansible on GitHub Very fast learning curve Python based Easy to get


slide-1
SLIDE 1

Ansible Wechat Account

slide-2
SLIDE 2

Ansible Meetup Shanghai August 17th

slide-3
SLIDE 3

wiredcraft.com ansible.com

slide-4
SLIDE 4

Introduction

slide-5
SLIDE 5

What is Ansible?

  • Ansible.com
  • Ansible on GitHub
  • Python based
  • Easy to extend
  • Agent-less
  • Gaining momentum
  • Very fast learning

curve

  • Easy to get started
slide-6
SLIDE 6

Similar Tools

  • salt-stack: python based, server / agent

(minions)

  • puppet: ruby based, server/agent - harder
  • chef: ruby based, server/agent - harder
  • capistrano: ruby based, more focused toward

deployment workflow

slide-7
SLIDE 7

Install and Configuration

Install

  • either through your package manager, yum / apt-get
  • or better through pip install ansible for the latest versions

Configuration

  • environment variables
  • ansible.cfg in current folder, home dir or /etc/ansible

Latest version are "preferred" as Ansible evolves very quickly with bug fixes and new features (4 months ago newest release and daily pull request)

slide-8
SLIDE 8

Concepts

slide-9
SLIDE 9

Ansible Concepts

YAML

  • used everywhere; to list tasks, handlers, variables, etc.
  • it's the easiest way to have a structured yet reader friendly file

structure (e.g. compared to json) Modules

  • atomic operations
  • manage idempotence
  • many are core, lots are community, covers from cloud service (aws), to

lineinfile, to file, to ...

slide-10
SLIDE 10

Ansible Concepts

Playbook

  • sequential list of operation
  • collection of tasks, handlers

Tasks / Handlers

  • tasks: has a name, executes a module action, completes with

either success / failure / skipped

  • handlers: "sleeping" tasks that can be invoked by a task upon

completion (e.g. when config file change, restart service)

slide-11
SLIDE 11

Ansible Concepts

Variables

  • host_vars - host specific variables
  • group_vars - group specific variables
  • file vars - external file that can be used to load some variables

(syntax -e "@filename.yml")

  • vars registration - one can register variable during the execution of a

playbook for future use Inventory

  • collection of hosts / groups
slide-12
SLIDE 12

Tool Belt CLI

slide-13
SLIDE 13

Tool Belt

Ansible

  • used to run simple modules
  • ansible all -i hosts -m ping

Ansible-playbook

  • used to execute a playbook
  • ansible-playbook -i hosts playbook.yml
slide-14
SLIDE 14

Tool Belt

Ansible-vault

  • used to access and load secrets

Ansible-galaxy

  • used to search, fetch roles
  • ansible-galaxy install user.roles fetch and install a role

globally (in `/etc/ansible/roles`)

  • ansible-galaxy install -r roles.txt -p roles fetch

and install roles defined in roles.txt file (similar to requirements.txt) and save in roles folder

slide-15
SLIDE 15

Roles / Galaxy

  • Community driven collection of roles at http://

galaxy.ansible.com

  • Roles are collection of tasks / handlers used to

tackle larger set of tasks - e.g. setup, install, configure nginx and the vhosts

slide-16
SLIDE 16

Questions?

slide-17
SLIDE 17

Live Demo

slide-18
SLIDE 18

Next Meetup and Feedback