From f2db400ed8697e4d81409efe4af2fbe7eda1ee32 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Wed, 4 Mar 2020 17:06:14 +0100 Subject: [PATCH] Update Vagrant setup to Debian Buster and libvirt --- Vagrantfile | 12 +++++---- change-vmdebootstrap-default-dhcp.sh | 15 +++++++++++ docs/changelog.rst | 1 + salt/bootstrap.sh | 39 ---------------------------- salt/grains | 12 +++++++++ salt/minion | 11 ++++++++ 6 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 change-vmdebootstrap-default-dhcp.sh delete mode 100755 salt/bootstrap.sh create mode 100644 salt/grains create mode 100644 salt/minion diff --git a/Vagrantfile b/Vagrantfile index 830f1ae..29fc338 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : Vagrant.configure(2) do |config| - config.vm.box = "debian/contrib-jessie64" + config.vm.box = "debian/buster64" config.vm.hostname = "gvafile.local" config.vm.network "private_network", ip: "172.16.3.4" @@ -10,18 +10,20 @@ Vagrant.configure(2) do |config| config.vm.synced_folder "../gvasalt/states/", "/srv/salt/" config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/" - config.vm.provider "virtualbox" do |vb| - # vb.gui = true - vb.memory = "512" + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 1024 end + config.vm.provision :shell, path: "change-vmdebootstrap-default-dhcp.sh" + config.vm.provision :salt do |salt| - salt.bootstrap_script = "salt/bootstrap.sh" + salt.bootstrap_options = "-x python3" salt.minion_id = "gvafile" salt.masterless = true salt.run_highstate = true salt.verbose = true salt.colorize = true salt.log_level = "warning" + salt.grains_config = "salt/grains" end end diff --git a/change-vmdebootstrap-default-dhcp.sh b/change-vmdebootstrap-default-dhcp.sh new file mode 100644 index 0000000..a5f3c38 --- /dev/null +++ b/change-vmdebootstrap-default-dhcp.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +debootstrap_network=/etc/systemd/network/99-dhcp.network + +if grep -q '^Name=\\*' "${debootstrap_network}"; then + primary_nic=$(ls -1 /sys/class/net | grep -v lo |sort | head -1) + sed -i "s/^Name=e\\*/Name=${primary_nic}/" \ + "${debootstrap_network}" + systemctl restart systemd-networkd.service + echo "Changed systemd network configuration" +else + echo "Systemd network configuration has already been changed" +fi diff --git a/docs/changelog.rst b/docs/changelog.rst index b24a5e9..071691b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,7 @@ Changelog ========= +* :support:`-` update Vagrant setup to libvirt and Debian Buster * :support:`-` move fileservertasks to top level to keep the task names when using Python 3 * :support:`2` use Pipenv for dependency management diff --git a/salt/bootstrap.sh b/salt/bootstrap.sh deleted file mode 100755 index ecc211a..0000000 --- a/salt/bootstrap.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - - -echo "deb http://httpredir.debian.org/debian jessie-backports main" >/etc/apt/sources.list.d/backports.list - -apt-get update -apt-get install -y -t jessie-backports python-cryptography - -# We just download the bootstrap script by default and execute that. -if [ -x /usr/bin/fetch ]; then - /usr/bin/fetch -o - https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" -elif [ -x /usr/bin/curl ]; then - /usr/bin/curl -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@" -else - python \ - -c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh").read()' \ - | sh -s -- "$@" -fi - -cat >/etc/salt/minion </etc/salt/grains <