Skip to content

Instantly share code, notes, and snippets.

@schlomo schlomo/Vagrantfile
Created May 2, 2017

Embed
What would you like to do?
Vagrantfile to show the autorelabel bug with centos/7 Vagrant images. See https://github.com/rear/rear-workshop-osbconf-2016/issues/4 and https://bugs.centos.org/view.php?id=13213
# BUG proof for VirtualBox vagrant with centos/7 failing to run autorelabel
#
# before starting install the reload plugin with: vagrant plugin install vagrant-reload
#
# see the bug: vagrant up
# destroy VM: vagrant destroy -f
# see the fix (disable serial console): FIX=1 vagrant up
#
# destroy VM: vagrant destroy -f
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
config.vm.synced_folder ".", "/vagrant", disabled: true
if ENV['FIX']
config.vm.provision "shell", inline: <<-SHELL
set -x
sed -i -e 's/ console=[^ ]\\+\\?//g' /etc/default/grub
cat /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
SHELL
end
config.vm.provision "shell", inline: <<-SHELL
set -x
touch /.autorelabel
SHELL
config.vm.provision :reload
config.vm.provision "shell", inline: <<-SHELL
set -x
ls -l /.autorelabel || : "************ AUTORELABELING DONE ***************"
systemctl status rhel-autorelabel
grep ttyS0 /proc/cmdline /etc/default/grub /boot/grub2/grub.cfg || : "************ EVERYTING IS FINE NOW ***************"
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.