Vagrantfile 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. VAGRANTFILE_API_VERSION = "2"
  4. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  5. config.vm.boot_timeout = 360
  6. config.vm.provider "virtualbox" do |vb|
  7. vb.memory = "2048"
  8. vb.cpus = "1"
  9. end
  10. #LoadBalancer
  11. config.vm.define "loadbalancer" do |loadbalancer|
  12. loadbalancer.vm.box = 'ubuntu/focal64'
  13. loadbalancer.vm.hostname = "loadbalancer"
  14. loadbalancer.vm.network :private_network, ip: "192.168.56.10"
  15. loadbalancer.vm.provision "shell", inline: "apt-get install -y haproxy"
  16. #Provision the loadbalancer with Ansible
  17. loadbalancer.vm.provision "ansible" do |ansible|
  18. ansible.compatibility_mode = "2.0"
  19. ansible.playbook="provisioning/ansible/haproxy.yml"
  20. ansible.become = true
  21. ansible.extra_vars = {
  22. ansible_python_interpreter: "/usr/bin/python3",
  23. ssl_name: "nextcloud.test",
  24. network_allowed: "192.168.56.0/24",
  25. haproxy_backend_servers:
  26. { name: 'web', ip: '192.168.56.14:8000' },
  27. }
  28. end
  29. end
  30. #Redis Server
  31. config.vm.define "redis" do |redis|
  32. redis.vm.hostname = "redis"
  33. redis.vm.box = "centos/7"
  34. redis.vm.network "private_network", ip: "192.168.56.12"
  35. redis.vm.provision "shell", inline: "yum install -y python3 dnf epel-release"
  36. #Provision the webserver with Ansible
  37. redis.vm.provision "ansible" do |ansible|
  38. ansible.compatibility_mode = "2.0"
  39. ansible.playbook="provisioning/ansible/redis.yml"
  40. ansible.become = true
  41. ansible.extra_vars = {
  42. ansible_python_interpreter: "/usr/bin/python2",
  43. #redis_bind_interface: "192.168.56.14", #bug Centos
  44. }
  45. end
  46. end
  47. #Database Server
  48. config.vm.define "db" do |db|
  49. db.vm.hostname = "mariadb"
  50. db.vm.box = "centos/7"
  51. db.vm.network "private_network", ip: "192.168.56.13"
  52. db.vm.provision "shell", inline: "yum install -y python3 dnf"
  53. #Provision the webserver with Ansible
  54. db.vm.provision "ansible" do |ansible|
  55. ansible.compatibility_mode = "2.0"
  56. ansible.playbook="provisioning/ansible/mariadb.yml"
  57. ansible.become = true
  58. ansible.extra_vars = {
  59. ansible_python_interpreter: "/usr/bin/python2",
  60. app_bind_address: "192.168.56.14"
  61. }
  62. end
  63. end
  64. #Web Server
  65. config.vm.define "web" do |web|
  66. web.vm.hostname = "nextcloud"
  67. web.vm.box = "centos/7"
  68. web.vm.network "private_network", ip: "192.168.56.14"
  69. # Creating a Shared Directory between host and guest VM
  70. #web.vm.synced_folder "/apps/shared", "/shared"
  71. #Provision the webserver for nextcloud role ansible
  72. web.vm.provision "shell", path: "provisioning/install/Centos_7.sh"
  73. #Provision the webserver with Ansible
  74. web.vm.provision "ansible" do |ansible|
  75. ansible.compatibility_mode = "2.0"
  76. ansible.playbook = "provisioning/ansible/nextcloud.yml"
  77. ansible.become = true
  78. ansible.extra_vars = {
  79. ansible_python_interpreter: "/usr/bin/python2",
  80. db_host: "192.168.56.13",
  81. use_redis_server: "true",
  82. redis_host: "192.168.56.12",
  83. debug_speed: "false",
  84. }
  85. #ansible.inventory_path = "provisioning/apache.inventory"
  86. #ansible.verbose = "vvvv"
  87. end
  88. end
  89. #Prometheus
  90. config.vm.define "prometheus" do |prometheus|
  91. prometheus.vm.box = 'centos/7'
  92. prometheus.vm.hostname = "prometheus"
  93. prometheus.vm.network :private_network, ip: "192.168.56.11"
  94. prometheus.vm.provision "shell", path: "provisioning/install/Centos_7.sh"
  95. #Provision prometheus-grafana with Ansible
  96. prometheus.vm.provision "ansible" do |ansible|
  97. ansible.compatibility_mode = "2.0"
  98. ansible.playbook="provisioning/ansible/prometheus.yml"
  99. ansible.become = true
  100. ansible.extra_vars = {
  101. ansible_python_interpreter: "/usr/bin/python2",
  102. }
  103. end
  104. end
  105. #Node Exporter
  106. config.vm.define "node" do |node|
  107. node.vm.box = 'centos/7'
  108. node.vm.hostname = "nodexporter"
  109. node.vm.network :private_network, ip: "192.168.56.15"
  110. node.vm.provision "shell", path: "provisioning/install/Centos_7.sh"
  111. #Provision prometheus-grafana with Ansible
  112. node.vm.provision "ansible" do |ansible|
  113. ansible.compatibility_mode = "2.0"
  114. ansible.playbook="provisioning/ansible/node_exporter.yml"
  115. ansible.become = true
  116. ansible.extra_vars = {
  117. ansible_python_interpreter: "/usr/bin/python2",
  118. }
  119. end
  120. end
  121. #Grafana
  122. config.vm.define "grafana" do |grafana|
  123. grafana.vm.box = 'centos/7'
  124. grafana.vm.hostname = "grafana"
  125. grafana.vm.network :private_network, ip: "192.168.56.16"
  126. grafana.vm.provision "shell", path: "provisioning/install/Centos_7.sh"
  127. #Provision prometheus-grafana with Ansible
  128. grafana.vm.provision "ansible" do |ansible|
  129. ansible.compatibility_mode = "2.0"
  130. ansible.playbook="provisioning/ansible/grafana.yml"
  131. ansible.become = true
  132. ansible.extra_vars = {
  133. ansible_python_interpreter: "/usr/bin/python2",
  134. }
  135. end
  136. end
  137. config.vm.box_check_update = false
  138. end