-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsalt-master.sh
42 lines (35 loc) · 1012 Bytes
/
salt-master.sh
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
#!/bin/bash
set -e
sudo curl -fsSL -o /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest/salt-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest focal main" | sudo tee /etc/apt/sources.list.d/salt.list
apt-get update
apt install salt-master salt-minion -y
echo "auto_accept: True" > /etc/salt/master
cat << EOF > /etc/salt/master
auto_accept: True
pillar_roots:
base:
- /srv/pillar
int:
- /srv/pillar/int
file_roots:
base:
- /srv/salt
int:
- /srv/salt/int
EOF
systemctl restart salt-master
cat << EOF > /etc/salt/minion
master: salt-master
saltenv: int
EOF
cat << EOF > /etc/salt/grains
roles:
- salt
EOF
systemctl restart salt-minion
# create ln from / to home dir, due to vagrant can not support login via root.
rm -rf /srv
mkdir -p /home/vagrant/srv
chown vagrant:vagrant /home/vagrant/srv
ln -s /home/vagrant/srv /srv