Commit c76bd2b7 authored by Vincent Mazenod's avatar Vincent Mazenod
Browse files

add vagrant doc

parent c856ba56
# vagrant
![vagrant](images/vagrant.png "vagrant")<!-- .element width="30%" -->
**By HashiCorp**
## vagrant
* création / configuration d'environnements virtuels
* écrit en ruby
* [<i class="fa fa-github" aria-hidden="true"></i> hashicorp/vagrant](https://github.com/hashicorp/vagrant)
* [<i class="fa fa-gavel" aria-hidden="true"></i> The MIT Licens](https://github.com/hashicorp/vagrant/blob/master/LICENSE)
* outil ligne de commande
* se voit dans l'hyperviseur utilisé
## vagrant
* Il peut être considéré comme un wrapper d'hyperviseur
* VirtualBox
* libvirt
* VMware
* Amazon EC2
* supporte nativement docker depuis la 1.6
## Installation
* gem
gem install vagrant
* system
## Initialisation du projet
```
mkdir project && cd project
vagrant init
```
génère un Vagrantfile
```
Vagrant.configure("2") do |config|
config.vm.box = "base"
end
```
Beaucoup de commentaires ... laisser vous guidez
## Box
* Machines virtuelles préconfigurées (templates)
* [vagrant cloud](https://app.vagrantup.com/boxes/search)
* [vagrantbox.es](https://www.vagrantbox.es/)
* mis en cache
* nommage à la github "développeur/Box"
```
vagrant box add "ubuntu/xenial64"
vagrant box add "http://aka.ms/vagrant-win7-ie11"
vagrant box list
vagrant box remove "ubuntu/xenial64"
```
* [Creating a Base Box](https://www.vagrantup.com/docs/boxes/base.html)
* [<i class="fa fa-github" aria-hidden="true"></i> veewee](https://github.com/jedi4ever/veewee)
* [<i class="fa fa-github" aria-hidden="true"></i> How to Create a CentOS Vagrant Base Box](https://github.com/ckan/ckan/wiki/How-to-Create-a-CentOS-Vagrant-Base-Box)
## Premier pas
```
vagrant up #--provider=virtualbox
vagrant ssh
vagrant halt
vagrant suspend
vagrant reload
vagrant destroy #--force
```
## shared folders
$ ll /vagrant
montage automatique de .
autre possibilité à parir du vagrant file
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
## provisioning
via un simple script
```
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.provision "shell", path: "script.sh"
end
```
## provisioning
via [ansible](ansible.html)
```
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.provision "shell", path: "script.sh"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
end
end
```
### idéal pour tester les playbooks
## mapping de port
## vagrant pour tester apache
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>vagrant</title>
<link rel="stylesheet" href="../../node_modules/reveal.js/css/reveal.css">
<link rel="stylesheet" href="../../node_modules/reveal.js/css/theme/white.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="../../node_modules/reveal.js/lib/css/zenburn.css">
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../main.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../../node_modules/reveal.js/css/print/pdf.css' : '../../node_modules/reveal.js/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown="md/vagrant.md"
data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
data-charset="utf-8">
</section>
</div>
</div>
<script src="../../node_modules/reveal.js/lib/js/head.min.js"></script>
<script src="../../node_modules/reveal.js/js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: false,
dependencies: [
{ src: '../../node_modules/reveal.js/plugin/markdown/marked.js' },
{ src: '../../node_modules/reveal.js/plugin/markdown/markdown.js' },
{ src: '../../node_modules/reveal.js/plugin/notes/notes.js', async: true },
{ src: '../../node_modules/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>
......@@ -70,6 +70,7 @@
<li><a href="cri/vault.html">vault</a></li>
<li><a href="cri/ansible.html">ansible</a></li>
<li><a href="cri/terraform.html">terraform</a></li>
<li><a href="cri/vagrant.html">vagrant</a></li>
<li><a href="cri/aws.html">aws</a></li>
<h3>privacy</h3>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment