Este es el script "script.sh", que es llamado por el vagranfile. Pero sino, bien puede ejecutarse sobre una instalacion limpia de fedora core 27.
#!/bin/bash
echo root:balinux | chpasswd
yum -y install net-tools
yum -y install vim bind-utils
yum -y install docker
systemctl enable docker
yum -y install origin docker-registry
grep -v "#" /etc/ssh/sshd_config | grep . | grep -v "PasswordAuthentication no" > /tmp/salida
echo "PermitRootLogin yes" >> /tmp/salida
echo PasswordAuthentication yes >> /tmp/salida
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old
mv /tmp/salida /etc/ssh/sshd_config
systemctl restart sshd
#Cambiamos Pass Root
echo "search balinux.com.ar" > /etc/resolv.conf
echo "nameserver 192.168.0.147" >> /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
chattr +i /etc/resolv.conf
hostname ocp.balinux.com.ar
echo "hostname ocp.balinux.com.ar"
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
echo "192.168.0.147 ocp.balinux.com.ar ocp" >> /etc/hosts
echo "INSECURE_REGISTRY='--insecure-registry 172.30.0.0/16'" >> /etc/sysconfig/docker
systemctl daemon-reload
systemctl restart docker
cat << EOT > /root/cluster_up.sh
pkill docker
iptables -t nat -F
iptables -F
service docker restart
oc cluster up --public-hostname=192.168.0.147
iptables -I INPUT -s 0/0 -j ACCEPT
EOT
chmod +x /root/cluster_up.sh
echo "La instalacion esta lista, rebootee la maquina, y por favor ccrra /root/cluster_up.sh"
Y Manifiesto de vagrant, el Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
servers=[
{
:hostname => "ocp.balinux.com.ar",
:box => "bento/fedora-27",
:ram => 4200,
:cpu => 2,
:script => "sh /vagrant/script_fc.sh"
}
]
# 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
# you're doing.
Vagrant.configure("2") do |config|
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
node.vm.box = machine[:box]
node.vm.hostname = machine[:hostname]
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", machine[:ram], "--cpus", machine[:cpu]]
end
# config.vm.network "public_network", ip: "192.168.0.147"
# Agrego y borro
config.vm.network "public_network", ip: "192.168.0.147", bridge: "enp0s8: Ethernet", bootproto: "static", gateway: "192.168.0.1"
config.vm.provision "shell",
run: "always",
inline: "eval `route -n | awk '{ if ($8 ==\"enp0s3\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'`"
node.vm.provision "shell", inline: machine[:script], privileged: true, run: "once"
end
end
end
No comments:
Post a Comment