Added variant for Vagrant
This commit is contained in:
@@ -28,8 +28,7 @@ Sur votre portable :
|
||||
|
||||
```bash
|
||||
apt-get install ansible
|
||||
git clone https://github.com/barais/demoAnsible
|
||||
cd demoAnsible/lamp_ubuntu2204_2hosts_withroles
|
||||
cd lamp_ubuntu2204_2hosts_withroles
|
||||
# éditez le fichier hosts pour y mettre les IP de vos VMs ainsi que le login et le mot de passe
|
||||
nano -w hosts
|
||||
ansible-playbook site.yml -i hosts
|
||||
|
||||
23
run_demo.md
23
run_demo.md
@@ -2,15 +2,18 @@
|
||||
|
||||
## Setup
|
||||
|
||||
- Install Virtualbox
|
||||
- Install vagrant
|
||||
- Install ansible
|
||||
- Start the VMs using vagrant
|
||||
- Install Virtualbox (if libvirt provider is not used)
|
||||
|
||||
> Start the VMs using vagrant
|
||||
|
||||
```bash
|
||||
git clone https://github.com/barais/demoAnsible
|
||||
cd vagrant
|
||||
# Choose between libvirt and virtualbox depending on your provider
|
||||
cd vagrant/libvirt
|
||||
cd vagrant/virtualbox
|
||||
|
||||
# Start the VMs
|
||||
vagant up
|
||||
# Check that the VM are up
|
||||
# Check that you can login using ssh (ssh vagrant@192.168.56.141 # password: vagrant)
|
||||
@@ -18,7 +21,7 @@ vagant up
|
||||
|
||||
## Demo 1
|
||||
|
||||
Run the playbook
|
||||
- Run the playbook (verify that playbook parameters match your VMs)
|
||||
|
||||
```bash
|
||||
ansible-playbook playbook.yml -i hosts
|
||||
@@ -31,15 +34,7 @@ Try to access http://192.168.56.141/index.php
|
||||
- Kill the VMs and remove them.
|
||||
- Use vagrant to recreate them from scratch
|
||||
|
||||
```bash
|
||||
git clone https://github.com/barais/demoAnsible
|
||||
cd vagrant
|
||||
vagant up
|
||||
# Check that the VM are up
|
||||
# Check that you can login using ssh (ssh vagrant@192.168.56.141 # password: vagrant)
|
||||
```
|
||||
|
||||
Run the playbook
|
||||
- Run the playbook
|
||||
|
||||
```bash
|
||||
ansible-playbook site.yml -i hosts
|
||||
|
||||
27
vagrant/libvirt/Vagrantfile
vendored
Normal file
27
vagrant/libvirt/Vagrantfile
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# ####################################################################
|
||||
# ################### CONFIGURATION VARIABLES ########################
|
||||
# ####################################################################
|
||||
IMAGE_NAME = "generic/ubuntu2204" # Image to use
|
||||
MEM = 2048 # Amount of RAM
|
||||
CPU = 1 # Number of processors
|
||||
SLAVE_NBR = 2 # Number of slaves node
|
||||
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
# RAM and CPU config
|
||||
config.vm.provider "libvirt" do |v|
|
||||
v.memory = MEM
|
||||
v.cpus = CPU
|
||||
end
|
||||
|
||||
# Slave node config
|
||||
(1..SLAVE_NBR).each do |i|
|
||||
config.ssh.insert_key = false
|
||||
config.vm.define "slave-#{i}" do |slave|
|
||||
# OS and Hostname
|
||||
slave.vm.box = IMAGE_NAME
|
||||
slave.vm.hostname = "slave-#{i}"
|
||||
slave.vm.network "private_network", ip: "192.168.56.14#{i}"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
# ####################################################################
|
||||
# ################### CONFIGURATION VARIABLES ########################
|
||||
# ####################################################################
|
||||
IMAGE_NAME = "bento/ubuntu-22.04" # Image to use
|
||||
IMAGE_NAME = "generic/ubuntu-22.04" # Image to use
|
||||
MEM = 2048 # Amount of RAM
|
||||
CPU = 1 # Number of processors
|
||||
SLAVE_NBR = 2 # Number of slaves node
|
||||
Reference in New Issue
Block a user