-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
67 lines (51 loc) · 2.18 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "master" do |master|
master.vm.box = "bento/ubuntu-20.04"
master.vm.hostname = "master"
master.vm.network "private_network", ip: "192.168.33.20"
master.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
end
master.vm.provision "shell", inline: <<-SHELL
sudo apt install curl -y
mkdir /etc/apt/keyrings
sudo curl -fsSL -o /etc/apt/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/salt/py3/ubuntu/20.04/amd64/latest/salt-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/20.04/amd64/latest focal main" | sudo tee /etc/apt/sources.list.d/salt.list
apt-get update
apt-get install salt-master -y
apt-get install salt-ssh -y
apt-get install salt-api -y
echo "Restart salt master"
sudo systemctl restart salt-master.service
echo "Add minion IP to hosts"
echo "192.168.33.21 minion" >> /etc/hosts
SHELL
end
config.vm.define "minion" do |worker|
worker.vm.box = "bento/ubuntu-20.04"
worker.vm.hostname = "minion"
worker.vm.network "private_network", ip: "192.168.33.21"
worker.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 3072
end
worker.vm.provision "shell", inline: <<-SHELL
sudo apt install curl -y
mkdir /etc/apt/keyrings
sudo curl -fsSL -o /etc/apt/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/salt/py3/ubuntu/20.04/amd64/latest/salt-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/20.04/amd64/latest focal main" | sudo tee /etc/apt/sources.list.d/salt.list
apt-get update
apt-get install salt-minion -y
apt-get install salt-ssh -y
apt-get install salt-api -y
echo "Restart salt minion"
sudo systemctl restart salt-minion.service
echo "Add salt IP to hosts"
echo "192.168.33.20 salt" >> /etc/hosts
echo "192.168.33.20 salt-master" >> /etc/hosts
SHELL
end
end