Optimize Vagrant setup

- define grains to match optimized gvasalt repository
- define minion configuration in separate file
- drop custome salt/bootstrap.sh
- adapt Vagrantfile to use the custom grains file
- increase memory size of created VM to allow the salt provisioning to
  succeed
This commit is contained in:
Jan Dittberner 2020-03-03 22:11:46 +01:00
parent b54b8577cb
commit 9f662e3afb
4 changed files with 30 additions and 39 deletions

6
Vagrantfile vendored
View file

@ -12,8 +12,11 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder "../gvasalt/states/", "/srv/salt/"
config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/"
config.vm.provider :libvirt do |libvirt|
libvirt.memory = 1024
end
config.vm.provision :salt do |salt|
salt.bootstrap_script = "salt/bootstrap.sh"
salt.bootstrap_options = "-x python3"
salt.minion_id = "gvaldap"
salt.masterless = true
@ -21,5 +24,6 @@ Vagrant.configure(2) do |config|
salt.verbose = true
salt.colorize = true
salt.log_level = "warning"
salt.grains_config = "salt/grains"
end
end

View file

@ -1,38 +0,0 @@
#!/bin/sh -
apt-get update
apt-get install -y python3-cryptography
export salt_bootstrap_url=https://bootstrap.saltstack.com/
# We just download the bootstrap script by default and execute that.
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -o - $salt_bootstrap_url | sh -s -- "$@"
elif [ -x /usr/bin/curl ]; then
/usr/bin/curl -L $salt_bootstrap_url | sh -s -- "$@"
else
python3 -c "from urllib.request import urlopen; print(urlopen(\"$salt_bootstrap_url\").read().decode('utf-8'))" | sh -s -- "$@"
fi
mkdir -p /etc/salt
cat >/etc/salt/minion <<EOF
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log
EOF
umask 077
cat >/etc/salt/grains <<EOF
roles:
- ldapserver
- gnuviechadmin.gvaldap
EOF

14
salt/grains Normal file
View file

@ -0,0 +1,14 @@
gnuviechadmin:
user: vagrant
group: vagrant
amqpuser: ldap
appname: gvaldap
checkout: /vagrant
fullname: LDAP
giturl: gituser@nextgit.gnuviech-server.de:gnuviech/gvaldap.git
home: /home/vagrant
update_git: False
roles:
- vagrant
- ldapserver
- gnuviechadmin.gvaldap

11
salt/minion Normal file
View file

@ -0,0 +1,11 @@
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log