23
Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Embed Size (px)

Citation preview

Page 1: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 2: Ansible with vCloud Air Workshop Install, 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

Page 3: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 4: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 4

Ansible Components

• Inventory• Modules• Tasks• Plays• Playbooks

Page 5: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

Inventory• Hosts and Groups• Inventory Sources

Page 6: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 6

Inventory Concepts

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

Page 7: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 7

Inventory: Hosts

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

Page 8: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 8

Inventory: Hosts

Page 9: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 9

Inventory: Hosts

Page 10: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 10

Inventory: Hosts

Page 11: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 12: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 12

Modules Examples

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

Page 13: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 14: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 14

Tasks: Examples

Page 15: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 16: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 17: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

Plays• Play naming

• Hosts selection

• Play arguments

• Variables

• Tasks

• Concurrency and order of operations

• Conditionals

Page 18: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 18

Play Naming

- name: This is a Play

Page 19: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 19

Hosts Selection

- name: This is a Playhosts: web-servers

Page 20: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 20

Play Arguments

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

Page 21: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

CONFIDENTIAL 21

Variables

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

http_port: 80cache_dir: /opt/cache

Page 22: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Page 23: Ansible with vCloud Air Workshop Install, configure and use Ansible on your laptop to provision workloads in vCloud Air

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

Air