From 753e7f0ed76c4fc1345d6c371b8470704273ef52 Mon Sep 17 00:00:00 2001 From: David J Peacock Date: Wed, 7 Jul 2021 19:58:22 -0400 Subject: [PATCH] improve vagrant functionality this patch improves vagrant functionality by taking advantage of the non-root shell provisioner; namely via the privileged: false flag previously the vagrant dev environments were lacking utility in out of the box experience Change-Id: Iaabe918c7eee5ac18d1ffd393f59fda568088eb5 --- Vagrantfile.centos | 28 +++++++++++++++------------- Vagrantfile.ubuntu | 28 +++++++++++++++------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Vagrantfile.centos b/Vagrantfile.centos index c97e1510..bf74e06e 100644 --- a/Vagrantfile.centos +++ b/Vagrantfile.centos @@ -4,25 +4,27 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end - config.vm.provision "shell", inline: <<-SHELL - echo "export TERM=xterm">>/home/vagrant/.bashrc + config.vm.provision "shell", inline: <<-ROOTSHELL echo "export TERM=xterm">>/root/.bashrc dnf update -y dnf install -y epel-release yum-config-manager --disable epel dnf install -y python3-devel gcc git vim dnf install -y --enablerepo epel ansible - git clone https://opendev.org/openstack/validations-libs - git clone https://opendev.org/openstack/validations-common - pushd validations-libs - sudo -u vagrant pip3 install --user -r requirements.txt - python3 setup.py install + mkdir -p /etc/ansible + echo "localhost ansible_connection=local" >> /etc/ansible/hosts + ROOTSHELL + config.vm.provision "shell", privileged: false, inline: <<-NONROOTSHELL + echo "export TERM=xterm">>/home/vagrant/.bashrc + git clone https://opendev.org/openstack/validations-libs vl-dev + pushd vl-dev + sudo python3 -m pip install . -r requirements.txt popd - pushd validations-common - sudo -u vagrant pip3 install --user -r requirements.txt - python3 setup.py install + git clone https://opendev.org/openstack/validations-common vc-dev + pushd vc-dev + sudo python3 -m pip install . -r requirements.txt popd - ln -s /usr/local/share/ansible/validations-playbooks /usr/share/ansible/validations-playbooks - mkdir -p /var/log/validations - SHELL + sudo ln -s /usr/local/share/ansible/validations-playbooks /usr/share/ansible/validations-playbooks + sudo mkdir -p /var/log/validations + NONROOTSHELL end diff --git a/Vagrantfile.ubuntu b/Vagrantfile.ubuntu index 0babeb11..b414948c 100644 --- a/Vagrantfile.ubuntu +++ b/Vagrantfile.ubuntu @@ -3,23 +3,25 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end - config.vm.provision "shell", inline: <<-SHELL - echo "export TERM=xterm">>/home/vagrant/.bashrc + config.vm.provision "shell", inline: <<-ROOTSHELL echo "export TERM=xterm">>/root/.bashrc apt-get -y update apt-get -y upgrade apt-get -y install ansible git python3-pip vim - git clone https://opendev.org/openstack/validations-libs - git clone https://opendev.org/openstack/validations-common - pushd validations-libs - pip3 install -r requirements.txt - python3 setup.py install + mkdir -p /etc/ansible + echo "localhost ansible_connection=local" >> /etc/ansible/hosts + ROOTSHELL + config.vm.provision "shell", privileged: false, inline: <<-NONROOTSHELL + echo "export TERM=xterm">>/home/vagrant/.bashrc + git clone https://opendev.org/openstack/validations-libs vl-dev + pushd vl-dev + sudo python3 -m pip install . -r requirements.txt popd - pushd validations-common - pip3 install -r requirements.txt - python3 setup.py install + git clone https://opendev.org/openstack/validations-common vc-dev + pushd vc-dev + sudo python3 -m pip install . -r requirements.txt popd - ln -s /usr/local/share/validations-common /usr/share/validations-common - mkdir -p /var/log/validations - SHELL + sudo ln -s /usr/local/share/validations-common /usr/share/validations-common + sudo mkdir -p /var/log/validations + NONROOTSHELL end