# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.boot_timeout = 360 config.vm.provider "virtualbox" do |vb| vb.memory = "2048" vb.cpus = "1" end #LoadBalancer config.vm.define "loadbalancer" do |loadbalancer| loadbalancer.vm.box = 'ubuntu/focal64' loadbalancer.vm.hostname = "loadbalancer" loadbalancer.vm.network :private_network, ip: "192.168.56.10" loadbalancer.vm.provision "shell", inline: "apt-get install -y haproxy" #Provision the loadbalancer with Ansible loadbalancer.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/haproxy.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python3", ssl_name: "nextcloud.test", network_allowed: "192.168.56.0/24", haproxy_backend_servers: { name: 'web', ip: '192.168.56.14:8000' }, } end end #Redis Server config.vm.define "redis" do |redis| redis.vm.hostname = "redis" redis.vm.box = "centos/7" redis.vm.network "private_network", ip: "192.168.56.12" redis.vm.provision "shell", inline: "yum install -y python3 dnf epel-release" #Provision the webserver with Ansible redis.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/redis.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", #redis_bind_interface: "192.168.56.14", #bug Centos } end end #Database Server config.vm.define "db" do |db| db.vm.hostname = "mariadb" db.vm.box = "centos/7" db.vm.network "private_network", ip: "192.168.56.13" db.vm.provision "shell", inline: "yum install -y python3 dnf" #Provision the webserver with Ansible db.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/mariadb.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", app_bind_address: "192.168.56.14" } end end #Web Server config.vm.define "web" do |web| web.vm.hostname = "nextcloud" web.vm.box = "centos/7" web.vm.network "private_network", ip: "192.168.56.14" # Creating a Shared Directory between host and guest VM #web.vm.synced_folder "/apps/shared", "/shared" #Provision the webserver for nextcloud role ansible web.vm.provision "shell", path: "provisioning/install/Centos_7.sh" #Provision the webserver with Ansible web.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook = "provisioning/ansible/nextcloud.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", db_host: "192.168.56.13", use_redis_server: "true", redis_host: "192.168.56.12", debug_speed: "false", } #ansible.inventory_path = "provisioning/apache.inventory" #ansible.verbose = "vvvv" end end #Prometheus config.vm.define "prometheus" do |prometheus| prometheus.vm.box = 'centos/7' prometheus.vm.hostname = "prometheus" prometheus.vm.network :private_network, ip: "192.168.56.11" prometheus.vm.provision "shell", path: "provisioning/install/Centos_7.sh" #Provision prometheus-grafana with Ansible prometheus.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/prometheus.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", } end end #Node Exporter config.vm.define "node" do |node| node.vm.box = 'centos/7' node.vm.hostname = "nodexporter" node.vm.network :private_network, ip: "192.168.56.15" node.vm.provision "shell", path: "provisioning/install/Centos_7.sh" #Provision prometheus-grafana with Ansible node.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/node_exporter.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", } end end #Grafana config.vm.define "grafana" do |grafana| grafana.vm.box = 'centos/7' grafana.vm.hostname = "grafana" grafana.vm.network :private_network, ip: "192.168.56.16" grafana.vm.provision "shell", path: "provisioning/install/Centos_7.sh" #Provision prometheus-grafana with Ansible grafana.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook="provisioning/ansible/grafana.yml" ansible.become = true ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python2", } end end config.vm.box_check_update = false end