Skip to content

Instantly share code, notes, and snippets.

@Schnabulator
Last active June 17, 2020 18:40
Show Gist options
  • Save Schnabulator/adb861f13df82ef5b16c556791a765f0 to your computer and use it in GitHub Desktop.
Save Schnabulator/adb861f13df82ef5b16c556791a765f0 to your computer and use it in GitHub Desktop.
start a bridged vm with static ip (change if necessary). After this script runned just ssh into the machine and start the install_pihole.sh skript
# mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
#0#R0're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/bionic64"
# Bridged network with fixed ip on *.23!
config.vm.network "public_network"#, ip: "192.168.XXX.XXX" #insert static ip for the vm & dont forget to use these while installing pihole
config.vm.hostname = "pihole" #should be available as pihole hostname
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
vb.memory = "512"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
apt-get update
# disable and stop default dns settings
service systemd-resolv stop
systemctl disable systemd-resolv
mv /etc/resolv.conf /home/vagrant/resolv.conf.bak #just a backup for any case
echo "curl -sSL https://install.pi-hole.net | bash" > install_pihole.sh
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment