Browse Source

Change byo network and add CentOS support

Michael Gugino 6 years ago
parent
commit
4a8c5cea83

+ 29 - 0
test/libvirt/README.md

@@ -7,20 +7,49 @@ for supported installation methods.
 ## How to use
 Don't use it.
 
+## RHEL specific steps
 clone https://github.com/openshift/aos-ansible/pull/74 to ~/git/aos-ansible
 (Red Hat use only)
 
+# Setup
+
 Ensure openshift-install and terraform are in your path.
 
 cd to this directory.
 
+## One time scripts
+You should run the following once ever.
+```sh
+./ssh_config.sh
+sudo ./dnsmasq_setup.sh
+```
+
+This will configure ~/.ssh/config to ensure entries aren't added to know hosts
+and configure dnsmasq to route dns requests to the right interface.
+
+## Source environment variables.
+
 source installrc; export variables you want to override.  You'll need to at least
 update what image you want to use unless you have that exact image in that exact
 place.
 
+If installing with CentOS, you can source installrc_centos after sourcing
+installrc.  This will setup image URI and ssh user.
+
+Only CentOS or RHEL is supported at this time, you cannot deploy both at the
+same time using these scripts.
+
+## Install RHEL
 ./deploy.sh
 This will generate install assets (inventory, install-config.yml, tfvars),
 provision instances via terraform and start installation of
 openshift-ansible.
 
+## Install CentOS
+Image: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1809.qcow2.xz
+Be sure to save that to ~/images/ and xz -d.
+
+./deploy_centos.sh
+
+## Cleanup
 Afterwards, you can cleanup with ./cleanup.sh

+ 9 - 0
test/libvirt/deploy_centos.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+#. installrc
+set -e
+./generate_assets.sh
+./terraform_provision.sh
+echo "sleeping 20"
+sleep 20
+openshift-install create ignition-configs
+./run_ansible.sh

+ 8 - 0
test/libvirt/dnsmasq_setup.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+# run this as sudo
+cat << EOF > /etc/NetworkManager/dnsmasq.d/byo-dev.conf
+server=/ttb.testing/192.168.128.1
+address=/.apps.byo-dev.ttb.testing/192.168.128.21
+EOF
+
+systemctl reload NetworkManager

+ 11 - 9
test/libvirt/installrc

@@ -1,23 +1,25 @@
 #!/bin/bash
 
-export OCP_BASE_DOMAIN="tt.testing"
+export OCP_BASE_DOMAIN="ttb.testing"
 export OCP_CLUSTER_ID=$(uuidgen --random)
 export OCP_MASTERS=1
 export OCP_WORKERS=1
 export OCP_CLUSTER_NAME="byo-dev"
 export OCP_PULL_SECRET=$(cat ~/try.openshift.com.json)
 export OCP_SSH_PUB_KEY=$(cat ~/.ssh/id_rsa.pub)
-export OCP_IMAGE=~/images/rhel-guest-image-7.5-146.x86_64.qcow2
-export OCP_NETDEV=tt0
-export OCP_NETCIDR="192.168.126.0/24"
+export OCP_NETDEV=ttb0
+export OCP_NETCIDR="192.168.128.0/24"
 # OCP_MASTERS is a list of quoted ips, no trailing comma.  eg:
-# "\"192.168.126.11\", \"192.168.126.12\""
-export OCP_MASTER_IPS=\"192.168.126.11\"
-export OCP_BOOTSTRAP_IP="192.168.126.10"
+# "\"192.168.128.11\", \"192.168.128.12\""
+export OCP_MASTER_IPS=\"192.168.128.11\"
+export OCP_BOOTSTRAP_IP="192.168.128.10"
+export OCP_WORKER_IPS=\"192.168.128.21\"
 export OCP_LIBVIRT_URI='qemu+tcp://192.168.124.1/system'
 export OCP_INSTALL_CONFIG_PATH="$PWD/install-config-ansible.yml"
 export OCP_IGNITION_PATH="$PWD/bootstrap.ign"
 
-export OCP_WORKER_IPS=\"192.168.126.21\"
-
 export ANSIBLE_HOST_KEY_CHECKING=False
+
+# RHEL specific stuff
+export OCP_IMAGE=~/images/rhel-guest-image-7.5-146.x86_64.qcow2
+export OCP_SSH_USER="cloud-user"

+ 4 - 0
test/libvirt/installrc_centos

@@ -0,0 +1,4 @@
+#!/bin/bash
+# source installrc first.
+export OCP_IMAGE=~/images/CentOS-7-x86_64-GenericCloud-1809.qcow2
+export OCP_SSH_USER="centos"

+ 1 - 1
test/libvirt/inv.txt.template

@@ -4,7 +4,7 @@ masters
 workers
 
 [nodes:vars]
-ansible_ssh_user=cloud-user
+ansible_ssh_user=${OCP_SSH_USER}
 ansible_become=True
 
 openshift_install_config_path="${OCP_INSTALL_CONFIG_PATH}"

+ 7 - 0
test/libvirt/ssh_config.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+cat << EOF >> ~/.ssh/config
+Host *.ttb.testing
+  StrictHostKeyChecking no
+  UserKnownHostsFile /dev/null
+EOF