diff options
author | Larry Smith Jr <mrlesmithjr@gmail.com> | 2016-12-03 17:51:25 -0500 |
---|---|---|
committer | Larry Smith Jr <mrlesmithjr@gmail.com> | 2016-12-03 17:51:25 -0500 |
commit | 109c6b750751d1c5cd216ad2f09258cf512c4c9e (patch) | |
tree | 0b276b62a25937dd5edb6d905952cf107b7c88ca /Vagrant/roles/ansible-rabbitmq/Vagrantfile | |
parent | 8f8673fb8dfa2bd4fa2694cbfdcb6eed54e502de (diff) | |
download | ansible-rabbitmq-109c6b750751d1c5cd216ad2f09258cf512c4c9e.tar.gz ansible-rabbitmq-109c6b750751d1c5cd216ad2f09258cf512c4c9e.tar.zst ansible-rabbitmq-109c6b750751d1c5cd216ad2f09258cf512c4c9e.zip |
Addressed issue #6
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.com>
Diffstat (limited to 'Vagrant/roles/ansible-rabbitmq/Vagrantfile')
-rw-r--r-- | Vagrant/roles/ansible-rabbitmq/Vagrantfile | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Vagrant/roles/ansible-rabbitmq/Vagrantfile b/Vagrant/roles/ansible-rabbitmq/Vagrantfile new file mode 100644 index 0000000..9c68a3d --- /dev/null +++ b/Vagrant/roles/ansible-rabbitmq/Vagrantfile | |||
@@ -0,0 +1,63 @@ | |||
1 | # -*- mode: ruby -*- | ||
2 | # vi: set ft=ruby : | ||
3 | |||
4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
5 | # configures the configuration version (we support older styles for | ||
6 | # backwards compatibility). Please don't change it unless you know what | ||
7 | # you're doing. | ||
8 | Vagrant.configure(2) do |config| | ||
9 | #Define if running desktop OS to yes otherwise no | ||
10 | Desktop = "no" | ||
11 | #Define the number of nodes to spin up | ||
12 | N = 3 | ||
13 | |||
14 | #Iterate over nodes | ||
15 | (1..N).each do |node_id| | ||
16 | nid = (node_id - 1) | ||
17 | |||
18 | config.vm.define "node#{nid}" do |node| | ||
19 | node.vm.box = "mrlesmithjr/centos-7" | ||
20 | node.vm.provider "virtualbox" do |vb| | ||
21 | vb.memory = "1024" | ||
22 | vb.cpus = "1" | ||
23 | if Desktop == "yes" | ||
24 | vb.gui = true | ||
25 | vb.customize ["modifyvm", :id, "--graphicscontroller", "vboxvga"] | ||
26 | vb.customize ["modifyvm", :id, "--accelerate3d", "on"] | ||
27 | vb.customize ["modifyvm", :id, "--ioapic", "on"] | ||
28 | vb.customize ["modifyvm", :id, "--vram", "128"] | ||
29 | vb.customize ["modifyvm", :id, "--hwvirtex", "on"] | ||
30 | end | ||
31 | end | ||
32 | node.vm.hostname = "node#{nid}" | ||
33 | ### Define additional network adapters below | ||
34 | node.vm.network :private_network, ip: "192.168.202.#{200 + nid}" | ||
35 | |||
36 | ### Define port forwards below | ||
37 | # node.vm.network "forwarded_port", guest: 80, host: "#{8080 + nid}" | ||
38 | # node.vm.network "forwarded_port", guest: 3000, host: "#{3000 + nid}" | ||
39 | |||
40 | if node_id == N | ||
41 | node.vm.provision :shell, path: "bootstrap.sh", keep_color: "true" #runs initial shell script | ||
42 | node.vm.provision "ansible" do |ansible| #runs bootstrap Ansible playbook | ||
43 | ansible.limit = "all" | ||
44 | ansible.playbook = "bootstrap.yml" | ||
45 | end | ||
46 | node.vm.provision "ansible" do |ansible| #runs Ansible playbook for installing roles/executing tasks | ||
47 | ansible.limit = "all" | ||
48 | ansible.playbook = "playbook.yml" | ||
49 | ansible.groups = { | ||
50 | "test-nodes" => [ | ||
51 | "node0", | ||
52 | "node1" | ||
53 | ], | ||
54 | "prod-nodes" => [ | ||
55 | "node2" | ||
56 | ] | ||
57 | } | ||
58 | end | ||
59 | end | ||
60 | |||
61 | end | ||
62 | end | ||
63 | end | ||