From 9f662e3afb37a9b8e8f442522a0f5018ad9b198a Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 3 Mar 2020 22:11:46 +0100 Subject: [PATCH] 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 --- Vagrantfile | 6 +++++- salt/bootstrap.sh | 38 -------------------------------------- salt/grains | 14 ++++++++++++++ salt/minion | 11 +++++++++++ 4 files changed, 30 insertions(+), 39 deletions(-) delete mode 100755 salt/bootstrap.sh create mode 100644 salt/grains create mode 100644 salt/minion diff --git a/Vagrantfile b/Vagrantfile index 479db84..3a03a6c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/salt/bootstrap.sh b/salt/bootstrap.sh deleted file mode 100755 index 52f5494..0000000 --- a/salt/bootstrap.sh +++ /dev/null @@ -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 </etc/salt/grains <