Skip to content

Instantly share code, notes, and snippets.

@hamnis
Created September 25, 2015 13:15
Show Gist options
  • Save hamnis/a859bdf2607a9c9a5fe8 to your computer and use it in GitHub Desktop.
Save hamnis/a859bdf2607a9c9a5fe8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Vagrant and Ansible</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# Vagrant and Ansible
---
# Agenda
1. What is Vagrant?
2. How to use Vagrant?
3. What is Ansible?
4. Ansible
5. Demo
---
#Goals
- Try to spike some interest about things that aren't just shell ;)
#Non-goals
- A complete and comprehensive guide to Ansible and Vagrant.
---
# What is Vagrant?
- Vagrant is an abstraction of virtual machines
--
- Vagrant is a description of One or more Virtual Machines.
--
- Vagrant is a tool to make Development easier.
---
# How to use Vagrant?
download a package from http://www.vagrantup.com/downloads
## On OSX:
```bash
brew cask install vagrant
```
## On Debian-derived GNU/Linux
```bash
curl http://bit.ly/1Vd6ryG -o /tmp/vagrant.deb
sudo dpkg -i /tmp/vagrant.deb
```
---
# How to use Vagrant?
Examples assumes you have installed [VirtualBox](http://virtualbox.org)
Simplest possible case
This command creates a `Vagrantfile`
```bash
vagrant init ubuntu/trusty64 http://bit.ly/1KyU5J9
```
This command starts the instance and provisions according to the [Provisioner](https://docs.vagrantup.com/v2/provisioning/ansible.html)
```bash
vagrant up
```
This command destroys the instance and the virtualbox instance with all data.
```bash
vagrant destroy
```
---
# What is [Ansible](http://www.ansible.com/)
##Wikipedia
<blockquote>
Ansible is a free software platform for configuring and managing computers. It combines multi-node software deployment, ad hoc task execution, and configuration management. It manages nodes over SSH or PowerShell and requires Python (2.4 or later) to be installed on them. Modules work over JSON and standard output and can be written in any programming language. The system uses YAML to express reusable descriptions of systems.
</blockquote>
In short; Its a configuration management platform that uses SSH.
---
# Ansible
A root ansible file is known as a <em>Playbook</em>
```yaml
---
- hosts: webservers
tasks:
- name: Gather information
copy: >
dest=/etc/motd.tail
content='Here be your message'
mode=0644
owner=root
group=root
sudo: yes
```
---
# Ansible role
An ansible role is a `directory` which has a special directory structure.
The goal of an Ansible role is to make a certain set of tasks reusable.
---
#Examples
##Installing
- nginx
--
count: false
- tomcat
--
count: false
- mysql
--
count: false
- content-engine
--
count: false
## Configuration of
- content-engine
--
count: false
- tomcat
--
count: false
- mysql user and database
---
# Ansible role
```
<rolename>
defaults?/main.yml
tasks/main.yml
meta?/main.yml
handlers?/main.yml
vars?/main.yml
files?/...
templates?/...
```
The <em>?</em> denotes an optional directory
The <em>...</em> denotes any type of file
Next to the playbook that needs the role, it usually lives within a `roles` directory.
---
# Ansible galaxy
A repository for re-usable roles found [here](https://galaxy.ansible.com/)
<aside>The quality of the different roles varies a lot.</aside>
---
class: center, middle
#DEMO
---
class: center, middle
# Q/A
---
# This might also be interesting
* ## packer.io seems like somthing to watch, especially when building tooling.
--
* ## Immutable infrastructure
--
* ## Combination with [asgard](https://github.com/Netflix/asgard). Used successfully at SPT ( Schibsted Product &amp; Technolgies)
---
class: center, middle
# Thanks
</textarea>
<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment