Skip to content

Commit 3135e00

Browse files
committed
local master
1 parent 2c1c68b commit 3135e00

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

resources/views.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
pacman-key --populate archlinux
101101
pacman -Syy
102102
pacman -S gnupg archlinux-keyring --noconfirm
103-
pacman -Su salt cloud-utils e2fsprogs --noconfirm --overwrite /usr/bin/growpart
103+
pacman -Su salt cloud-utils e2fsprogs qemu-guest-agent git --noconfirm --overwrite /usr/bin/growpart
104104
else
105105
apt-get update --allow-releaseinfo-change
106106
apt-get install curl -y
@@ -127,11 +127,13 @@
127127
fi
128128
129129
apt-get update
130-
apt-get install cloud-guest-utils e2fsprogs salt-minion -y
130+
apt-get install cloud-guest-utils e2fsprogs salt-minion salt-master qemu-guest-agent git -y
131131
fi
132132
133133
growpart /dev/vda 1 || /bin/true
134134
resize2fs /dev/vda1 || /bin/true
135+
136+
# Configure salt-minion
135137
echo "master: {vm_saltmaster}" > /etc/salt/minion
136138
echo "tcp_keepalive: True" >> /etc/salt/minion
137139
echo "tcp_keepalive_idle: 30" >> /etc/salt/minion
@@ -147,6 +149,24 @@
147149
echo "hypervisor: {hypervisor}" >> /etc/salt/grains
148150
systemctl stop salt-minion || /bin/true
149151
systemctl enable salt-minion || /bin/true
152+
153+
154+
# Configure salt-master (in case no central master is used)
155+
rm -rf /etc/homelabmanager
156+
(cd /etc/; git clone https://github.com/vdloo/homelabmanager)
157+
if [ ! -L /srv/salt ]; then ln -s /etc/homelabmanager/saltstack/salt /srv/salt; fi
158+
if [ ! -L /srv/pillar ]; then ln -s /etc/homelabmanager/saltstack/pillar /srv/pillar; fi
159+
if [ ! -L /srv/reactor ]; then ln -s /etc/homelabmanager/saltstack/reactor /srv/reactor; fi
160+
# Obviously never configure a Saltmaster like this in any real environment
161+
# We only bind on localhost, no external can connect to this salt-master
162+
echo "interface: 127.0.0.1" >> /etc/salt/master
163+
echo "open_mode: True" > /etc/salt/master
164+
echo "auto_accept: True" >> /etc/salt/master
165+
echo "reactor:" >> /etc/salt/master
166+
echo " - 'salt/minion/*/start':" >> /etc/salt/master
167+
echo " - /srv/reactor/salt.sls" >> /etc/salt/master
168+
systemctl stop salt-master || /bin/true
169+
systemctl enable salt-master || /bin/true
150170
rm -f /etc/salt/minion_id
151171
152172
# Delete the cloud-config config and reboot

0 commit comments

Comments
 (0)