Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete workshop2 - Jose Luis Restrepo Obando #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:a77302fc-a675-4e08-8031-b2889b047092
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1677720911
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"}
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/creator_uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1002
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a77302fc-a675-4e08-8031-b2889b047092
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/index_uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c11b8ef63d3446f5a5d4c73709221a66
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/synced_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}
1 change: 1 addition & 0 deletions .vagrant/machines/node-1/virtualbox/vagrant_cwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/adp/ws2/sd-workshop2
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:15b28647-4adf-4440-9069-d4df3d751878
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1677721039
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"}
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/creator_uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1002
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15b28647-4adf-4440-9069-d4df3d751878
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/index_uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53e4295dd3034a9b93210a35ef7beaf6
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/synced_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}
1 change: 1 addition & 0 deletions .vagrant/machines/node-2/virtualbox/vagrant_cwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/adp/ws2/sd-workshop2
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:0ecd9f65-ba64-410e-be3f-5fe147d4d1b7
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1677721179
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"}
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/creator_uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1002
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0ecd9f65-ba64-410e-be3f-5fe147d4d1b7
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/index_uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5111796959ea4f33ace76428c666c766
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/synced_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}
1 change: 1 addition & 0 deletions .vagrant/machines/node-3/virtualbox/vagrant_cwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/adp/ws2/sd-workshop2
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"}
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/vagrant_cwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/adp/ws2/sd-workshop2
9 changes: 9 additions & 0 deletions .vagrant/rgloader/loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
35 changes: 35 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.

Vagrant.configure("2") do |config|

#SSH key insertion disable
config.ssh.insert_key = false

#Loop for VM creation
(1..3).each do |i|

node_name = "node#{i}"

config.vm.define "node-#{i}" do |lb|
lb.vm.box = "centos/7"
lb.vm.hostname = node_name
lb.vm.network "private_network", ip: "192.168.56.1#{i}"
lb.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512", "--cpus", "1", "--name", node_name]
disk_var = "./disk#{i}.vdi"
unless File.exist?(disk_var)
vb.customize ['createhd', '--filename', disk_var, '--variant', 'Fixed', '--size', 5 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', disk_var]
end
lb.vm.provision "shell", path: "scripts/glusterfs.sh"
lb.vm.provision "shell", path: "scripts/configuration.sh"
end
end
end
7 changes: 7 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[defaults]
inventory=./ansible_hosts
remote_user=vagrant
private_key_file=$HOME/.vagrant.d/insecure_private_key
host_key_checking=False
retry_files_enabled=False
#interpreter_python=auto_silent
4 changes: 4 additions & 0 deletions ansible_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[servers]
node1 ansible_ssh_host=192.168.56.11
node2 ansible_ssh_host=192.168.56.12
node3 ansible_ssh_host=192.168.56.13
29 changes: 29 additions & 0 deletions playbooks/01-gluster-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- hosts: all
become: true
tasks:
- name: Add nodes to gluster cluster
gluster_peer:
state: present
nodes:
- node2
- node3

- name: Create volumen
gluster_volume:
state: present
name: gv0
bricks: /gluster/data/gv0
replicas: 3
cluster:
- node1
- node2
- node3

- name: Start volumen gluster
gluster_volume:
state: started
name: gv0

- name: Mount volumen gluster to mnt
shell: mount.glusterfs localhost:/gv0 /mnt
3 changes: 3 additions & 0 deletions scripts/configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "192.168.56.11 node1" >> /etc/hosts
echo "192.168.56.12 node2" >> /etc/hosts
echo "192.168.56.13 node3" >> /etc/hosts
14 changes: 14 additions & 0 deletions scripts/glusterfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
yum install -y centos-release-gluster
yum install -y glusterfs-server
yum install -y xfsprogs
service glusterd start

sfdisk /dev/sdb << EOF
;
EOF

mkfs.xfs /dev/sdb1
mkdir -p /gluster/data
# echo "/dev/sdb1 /gluster/data xfs default 1 2" >> /etc/fstab
mount /dev/sdb1 /gluster/data/
#mount -a && mount