2020-01-22 15:09:57 +00:00
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2020-01-27 20:44:38 +00:00
|
|
|
PRIVATE_NET_IP = "172.28.128.30"
|
|
|
|
|
2020-01-22 15:09:57 +00:00
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "centos/7"
|
2020-01-27 20:44:38 +00:00
|
|
|
config.vm.network "private_network", ip: PRIVATE_NET_IP
|
2020-01-22 19:57:33 +00:00
|
|
|
config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
|
|
|
|
|
|
|
config.vm.provider "virtualbox" do |vbox|
|
|
|
|
vbox.memory = 4096
|
|
|
|
vbox.cpus = 4
|
|
|
|
end
|
2020-01-22 16:44:41 +00:00
|
|
|
|
2020-01-22 15:09:57 +00:00
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
|
|
|
2020-01-28 20:42:48 +00:00
|
|
|
# Set SELinux to permissive
|
|
|
|
setenforce 0
|
|
|
|
sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config
|
|
|
|
|
2020-01-22 15:09:57 +00:00
|
|
|
# Import GPG keys
|
|
|
|
curl -s https://download.docker.com/linux/centos/gpg -o docker-key
|
|
|
|
rpm --import docker-key /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
|
|
|
|
|
|
|
|
# Install Docker Community Edition
|
|
|
|
yum-config-manager --add-repo \
|
|
|
|
https://download.docker.com/linux/centos/docker-ce.repo
|
|
|
|
yum install -y docker-ce docker-ce-cli containerd.io
|
|
|
|
systemctl start docker
|
2020-01-22 16:07:04 +00:00
|
|
|
systemctl -q enable docker
|
2020-01-22 15:09:57 +00:00
|
|
|
usermod -aG docker vagrant
|
|
|
|
|
2020-01-22 21:14:43 +00:00
|
|
|
# Convenience
|
|
|
|
yum install -y vim
|
|
|
|
|
|
|
|
# Install rsyslog
|
|
|
|
yum install -y rsyslog
|
|
|
|
systemctl start rsyslog
|
|
|
|
systemctl -q enable rsyslog
|
|
|
|
|
2020-01-27 20:44:38 +00:00
|
|
|
# Add rsyslog forwarding option if it does not exist
|
|
|
|
if ! grep -q "#{PRIVATE_NET_IP}:1514" /etc/rsyslog.conf; then
|
|
|
|
echo "*.* @@#{PRIVATE_NET_IP}:1514;RSYSLOG_SyslogProtocol23Format" >> /etc/rsyslog.conf
|
|
|
|
systemctl restart rsyslog
|
|
|
|
fi
|
|
|
|
|
2020-01-22 15:09:57 +00:00
|
|
|
SHELL
|
|
|
|
|
2020-01-22 15:20:11 +00:00
|
|
|
# Install newest docker-compose
|
|
|
|
config.vm.provision "shell", path: "install-compose.sh"
|
|
|
|
|
2020-01-22 19:57:33 +00:00
|
|
|
# Start compose services
|
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
|
|
cd /vagrant
|
|
|
|
/usr/local/bin/docker-compose -f wordpress.yml up -d 2> /dev/null
|
|
|
|
/usr/local/bin/docker-compose -f graylog.yml up -d 2> /dev/null
|
|
|
|
SHELL
|
|
|
|
|
2020-01-22 15:09:57 +00:00
|
|
|
end
|