From 4a8c5cea83dff2689c356e7214a35a528fda7ce6 Mon Sep 17 00:00:00 2001 From: Michael Gugino Date: Mon, 17 Dec 2018 15:30:30 -0500 Subject: [PATCH] Change byo network and add CentOS support --- test/libvirt/README.md | 29 +++++++++++++++++++++++++++++ test/libvirt/deploy_centos.sh | 9 +++++++++ test/libvirt/dnsmasq_setup.sh | 8 ++++++++ test/libvirt/installrc | 20 +++++++++++--------- test/libvirt/installrc_centos | 4 ++++ test/libvirt/inv.txt.template | 2 +- test/libvirt/ssh_config.sh | 7 +++++++ 7 files changed, 69 insertions(+), 10 deletions(-) create mode 100755 test/libvirt/deploy_centos.sh create mode 100755 test/libvirt/dnsmasq_setup.sh create mode 100755 test/libvirt/installrc_centos create mode 100755 test/libvirt/ssh_config.sh diff --git a/test/libvirt/README.md b/test/libvirt/README.md index 6bc9a8b232b..a8e301281e9 100644 --- a/test/libvirt/README.md +++ b/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 diff --git a/test/libvirt/deploy_centos.sh b/test/libvirt/deploy_centos.sh new file mode 100755 index 00000000000..4b1dceb4031 --- /dev/null +++ b/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 diff --git a/test/libvirt/dnsmasq_setup.sh b/test/libvirt/dnsmasq_setup.sh new file mode 100755 index 00000000000..6112d08f6de --- /dev/null +++ b/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 diff --git a/test/libvirt/installrc b/test/libvirt/installrc index 3d0397e6be5..a4a0f4bb801 100755 --- a/test/libvirt/installrc +++ b/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" diff --git a/test/libvirt/installrc_centos b/test/libvirt/installrc_centos new file mode 100755 index 00000000000..7e5629d8e0b --- /dev/null +++ b/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" diff --git a/test/libvirt/inv.txt.template b/test/libvirt/inv.txt.template index 3fdf7aecbbb..f80df215efa 100644 --- a/test/libvirt/inv.txt.template +++ b/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}" diff --git a/test/libvirt/ssh_config.sh b/test/libvirt/ssh_config.sh new file mode 100755 index 00000000000..3e059d7dcfd --- /dev/null +++ b/test/libvirt/ssh_config.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cat << EOF >> ~/.ssh/config +Host *.ttb.testing + StrictHostKeyChecking no + UserKnownHostsFile /dev/null +EOF