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
This commit is contained in:
David J Peacock 2021-07-07 19:58:22 -04:00
parent 85947ee8e0
commit 753e7f0ed7
2 changed files with 30 additions and 26 deletions

View File

@ -4,25 +4,27 @@ Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
vb.memory = "2048" vb.memory = "2048"
end end
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-ROOTSHELL
echo "export TERM=xterm">>/home/vagrant/.bashrc
echo "export TERM=xterm">>/root/.bashrc echo "export TERM=xterm">>/root/.bashrc
dnf update -y dnf update -y
dnf install -y epel-release dnf install -y epel-release
yum-config-manager --disable epel yum-config-manager --disable epel
dnf install -y python3-devel gcc git vim dnf install -y python3-devel gcc git vim
dnf install -y --enablerepo epel ansible dnf install -y --enablerepo epel ansible
git clone https://opendev.org/openstack/validations-libs mkdir -p /etc/ansible
git clone https://opendev.org/openstack/validations-common echo "localhost ansible_connection=local" >> /etc/ansible/hosts
pushd validations-libs ROOTSHELL
sudo -u vagrant pip3 install --user -r requirements.txt config.vm.provision "shell", privileged: false, inline: <<-NONROOTSHELL
python3 setup.py install 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 popd
pushd validations-common git clone https://opendev.org/openstack/validations-common vc-dev
sudo -u vagrant pip3 install --user -r requirements.txt pushd vc-dev
python3 setup.py install sudo python3 -m pip install . -r requirements.txt
popd popd
ln -s /usr/local/share/ansible/validations-playbooks /usr/share/ansible/validations-playbooks sudo ln -s /usr/local/share/ansible/validations-playbooks /usr/share/ansible/validations-playbooks
mkdir -p /var/log/validations sudo mkdir -p /var/log/validations
SHELL NONROOTSHELL
end end

View File

@ -3,23 +3,25 @@ Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
vb.memory = "2048" vb.memory = "2048"
end end
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-ROOTSHELL
echo "export TERM=xterm">>/home/vagrant/.bashrc
echo "export TERM=xterm">>/root/.bashrc echo "export TERM=xterm">>/root/.bashrc
apt-get -y update apt-get -y update
apt-get -y upgrade apt-get -y upgrade
apt-get -y install ansible git python3-pip vim apt-get -y install ansible git python3-pip vim
git clone https://opendev.org/openstack/validations-libs mkdir -p /etc/ansible
git clone https://opendev.org/openstack/validations-common echo "localhost ansible_connection=local" >> /etc/ansible/hosts
pushd validations-libs ROOTSHELL
pip3 install -r requirements.txt config.vm.provision "shell", privileged: false, inline: <<-NONROOTSHELL
python3 setup.py install 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 popd
pushd validations-common git clone https://opendev.org/openstack/validations-common vc-dev
pip3 install -r requirements.txt pushd vc-dev
python3 setup.py install sudo python3 -m pip install . -r requirements.txt
popd popd
ln -s /usr/local/share/validations-common /usr/share/validations-common sudo ln -s /usr/local/share/validations-common /usr/share/validations-common
mkdir -p /var/log/validations sudo mkdir -p /var/log/validations
SHELL NONROOTSHELL
end end