Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision...

Post on 05-Jan-2016

222 views 0 download

Transcript of Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision...

Ansible with vCloud Air WorkshopInstall, configure and use Ansible on your laptop to provision workloads in vCloud Air

AbstractLearn the basics of Ansible, use this workshop to install, setup and configure Ansible on your laptop. Once you have successfully configured Ansible, then learn how to use it for DevOps deployment into your vCloud Air environments.

Dylan Silva, Sales Engineer, Ansible Inc.

8/31/2015

What is Ansible?• SIMPLE

– Human Readable Automation

– No Special Coding Skills Required

– Tasks executed in order

– Get Productive Quickly

• AGENTLESS– No extra code to manage

– Uses OpenSSH

– No agents to exploit or update

– More Efficient and Secure

• POWERFUL– App Deployment

– Configuration Management

– Workflow Orchestration

– Orchestrate the app lifecycle

CONFIDENTIAL 4

Ansible Components

• Inventory• Modules• Tasks• Plays• Playbooks

Inventory• Hosts and Groups• Inventory Sources

CONFIDENTIAL 6

Inventory Concepts

• Hosts• Groups• Inventory-specific data• Static / Dynamic Sources

CONFIDENTIAL 7

Inventory: Hosts

• Defines:– Port and Address– Remote/sudo usernames– Connection type

CONFIDENTIAL 8

Inventory: Hosts

CONFIDENTIAL 9

Inventory: Hosts

CONFIDENTIAL 10

Inventory: Hosts

Modules• Bits of code copied to the target system.• Executed to satisfy the task declaration.• Customizable.

CONFIDENTIAL 12

Modules Examples

• vca_vapp• vca_nat• vca_fw• apt/yum• copy• file• service• template

TASKS• Directory should exist• Package should be installed• Service should be running• Render a template into a configuration file• vCloud Air instance should exist

CONFIDENTIAL 14

Tasks: Examples

CONFIDENTIAL 15

Using Modules in Tasks

- name: add cache dir file: path=/opt/cache state=directory

- name: install nginx yum: name=nginx state=present

- name: start nginx service: name=nginx enabled=yes state=started state=started

Exercise 1• Install Ansible• Setup key(s)• Run a couple of tasks

Plays• Play naming

• Hosts selection

• Play arguments

• Variables

• Tasks

• Concurrency and order of operations

• Conditionals

CONFIDENTIAL 18

Play Naming

- name: This is a Play

CONFIDENTIAL 19

Hosts Selection

- name: This is a Playhosts: web-servers

CONFIDENTIAL 20

Play Arguments

- name: This is a Playhosts: web-serversremote_user: fredsudo: yesconnection: ssh

CONFIDENTIAL 21

Variables

- name: This is a Playhosts: web-serversremote_user: fredsudo: yesconnection: sshvars:

http_port: 80cache_dir: /opt/cache

CONFIDENTIAL 22

Tasks- name: This is a Play

hosts: web-serversremote_user: fredsudo: yesconnection: sshvars:

http_port: 80cache_dir: /opt/cache

tasks: - name: create cache dir

file: path={{ cache_dir }} state=directory - name: install nginx

yum: name=nginx state=installed

Exercise 2• Download playbooks• Make modifications to playbooks• Execute Playbooks against vCloud

Air