diff --git a/.vagrant/machines/node-1/virtualbox/action_provision b/.vagrant/machines/node-1/virtualbox/action_provision new file mode 100644 index 0000000..ab55598 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/action_provision @@ -0,0 +1 @@ +1.5:a77302fc-a675-4e08-8031-b2889b047092 \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/action_set_name b/.vagrant/machines/node-1/virtualbox/action_set_name new file mode 100644 index 0000000..7e4ce12 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/action_set_name @@ -0,0 +1 @@ +1677720911 \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/box_meta b/.vagrant/machines/node-1/virtualbox/box_meta new file mode 100644 index 0000000..40ae0d3 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/box_meta @@ -0,0 +1 @@ +{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"} \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/creator_uid b/.vagrant/machines/node-1/virtualbox/creator_uid new file mode 100644 index 0000000..5ed13cb --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/creator_uid @@ -0,0 +1 @@ +1002 \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/id b/.vagrant/machines/node-1/virtualbox/id new file mode 100644 index 0000000..2891be2 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/id @@ -0,0 +1 @@ +a77302fc-a675-4e08-8031-b2889b047092 \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/index_uuid b/.vagrant/machines/node-1/virtualbox/index_uuid new file mode 100644 index 0000000..a5ff19c --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/index_uuid @@ -0,0 +1 @@ +c11b8ef63d3446f5a5d4c73709221a66 \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/synced_folders b/.vagrant/machines/node-1/virtualbox/synced_folders new file mode 100644 index 0000000..c3a9758 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/synced_folders @@ -0,0 +1 @@ +{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}} \ No newline at end of file diff --git a/.vagrant/machines/node-1/virtualbox/vagrant_cwd b/.vagrant/machines/node-1/virtualbox/vagrant_cwd new file mode 100644 index 0000000..b574683 --- /dev/null +++ b/.vagrant/machines/node-1/virtualbox/vagrant_cwd @@ -0,0 +1 @@ +/home/adp/ws2/sd-workshop2 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/action_provision b/.vagrant/machines/node-2/virtualbox/action_provision new file mode 100644 index 0000000..fc37aa0 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/action_provision @@ -0,0 +1 @@ +1.5:15b28647-4adf-4440-9069-d4df3d751878 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/action_set_name b/.vagrant/machines/node-2/virtualbox/action_set_name new file mode 100644 index 0000000..7c17422 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/action_set_name @@ -0,0 +1 @@ +1677721039 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/box_meta b/.vagrant/machines/node-2/virtualbox/box_meta new file mode 100644 index 0000000..40ae0d3 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/box_meta @@ -0,0 +1 @@ +{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"} \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/creator_uid b/.vagrant/machines/node-2/virtualbox/creator_uid new file mode 100644 index 0000000..5ed13cb --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/creator_uid @@ -0,0 +1 @@ +1002 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/id b/.vagrant/machines/node-2/virtualbox/id new file mode 100644 index 0000000..0ce89d4 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/id @@ -0,0 +1 @@ +15b28647-4adf-4440-9069-d4df3d751878 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/index_uuid b/.vagrant/machines/node-2/virtualbox/index_uuid new file mode 100644 index 0000000..299c25d --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/index_uuid @@ -0,0 +1 @@ +53e4295dd3034a9b93210a35ef7beaf6 \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/synced_folders b/.vagrant/machines/node-2/virtualbox/synced_folders new file mode 100644 index 0000000..c3a9758 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/synced_folders @@ -0,0 +1 @@ +{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}} \ No newline at end of file diff --git a/.vagrant/machines/node-2/virtualbox/vagrant_cwd b/.vagrant/machines/node-2/virtualbox/vagrant_cwd new file mode 100644 index 0000000..b574683 --- /dev/null +++ b/.vagrant/machines/node-2/virtualbox/vagrant_cwd @@ -0,0 +1 @@ +/home/adp/ws2/sd-workshop2 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/action_provision b/.vagrant/machines/node-3/virtualbox/action_provision new file mode 100644 index 0000000..e8e369e --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/action_provision @@ -0,0 +1 @@ +1.5:0ecd9f65-ba64-410e-be3f-5fe147d4d1b7 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/action_set_name b/.vagrant/machines/node-3/virtualbox/action_set_name new file mode 100644 index 0000000..cd080b6 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/action_set_name @@ -0,0 +1 @@ +1677721179 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/box_meta b/.vagrant/machines/node-3/virtualbox/box_meta new file mode 100644 index 0000000..40ae0d3 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/box_meta @@ -0,0 +1 @@ +{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"} \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/creator_uid b/.vagrant/machines/node-3/virtualbox/creator_uid new file mode 100644 index 0000000..5ed13cb --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/creator_uid @@ -0,0 +1 @@ +1002 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/id b/.vagrant/machines/node-3/virtualbox/id new file mode 100644 index 0000000..f5fdb14 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/id @@ -0,0 +1 @@ +0ecd9f65-ba64-410e-be3f-5fe147d4d1b7 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/index_uuid b/.vagrant/machines/node-3/virtualbox/index_uuid new file mode 100644 index 0000000..94c2fc7 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/index_uuid @@ -0,0 +1 @@ +5111796959ea4f33ace76428c666c766 \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/synced_folders b/.vagrant/machines/node-3/virtualbox/synced_folders new file mode 100644 index 0000000..c3a9758 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/synced_folders @@ -0,0 +1 @@ +{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/adp/ws2/sd-workshop2","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}} \ No newline at end of file diff --git a/.vagrant/machines/node-3/virtualbox/vagrant_cwd b/.vagrant/machines/node-3/virtualbox/vagrant_cwd new file mode 100644 index 0000000..b574683 --- /dev/null +++ b/.vagrant/machines/node-3/virtualbox/vagrant_cwd @@ -0,0 +1 @@ +/home/adp/ws2/sd-workshop2 \ No newline at end of file diff --git a/.vagrant/machines/node1/virtualbox/box_meta b/.vagrant/machines/node1/virtualbox/box_meta new file mode 100644 index 0000000..40ae0d3 --- /dev/null +++ b/.vagrant/machines/node1/virtualbox/box_meta @@ -0,0 +1 @@ +{"name":"centos/7","version":"2004.01","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/2004.01/virtualbox"} \ No newline at end of file diff --git a/.vagrant/machines/node1/virtualbox/vagrant_cwd b/.vagrant/machines/node1/virtualbox/vagrant_cwd new file mode 100644 index 0000000..b574683 --- /dev/null +++ b/.vagrant/machines/node1/virtualbox/vagrant_cwd @@ -0,0 +1 @@ +/home/adp/ws2/sd-workshop2 \ No newline at end of file diff --git a/.vagrant/rgloader/loader.rb b/.vagrant/rgloader/loader.rb new file mode 100644 index 0000000..c3c05b0 --- /dev/null +++ b/.vagrant/rgloader/loader.rb @@ -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 diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..d25919e --- /dev/null +++ b/Vagrantfile @@ -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 diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..0a86b33 --- /dev/null +++ b/ansible.cfg @@ -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 diff --git a/ansible_hosts b/ansible_hosts new file mode 100644 index 0000000..0cde291 --- /dev/null +++ b/ansible_hosts @@ -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 diff --git a/playbooks/01-gluster-automation.yml b/playbooks/01-gluster-automation.yml new file mode 100644 index 0000000..f3ac573 --- /dev/null +++ b/playbooks/01-gluster-automation.yml @@ -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 diff --git a/scripts/configuration.sh b/scripts/configuration.sh new file mode 100644 index 0000000..0b2b8b5 --- /dev/null +++ b/scripts/configuration.sh @@ -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 diff --git a/scripts/glusterfs.sh b/scripts/glusterfs.sh new file mode 100644 index 0000000..36d91f4 --- /dev/null +++ b/scripts/glusterfs.sh @@ -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