Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #171

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
*~
validate/env.sh
validate/.terraform
validate/terraform.*
validate/ip.tmp
openshift-ansible

/.idea/
/installcentos.iml
75 changes: 16 additions & 59 deletions install-openshift.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/bin/bash

## see: https://youtu.be/aqXSbDZggK4

## Default variables to use
export INTERACTIVE=${INTERACTIVE:="true"}
export PVS=${INTERACTIVE:="true"}
export DOMAIN=${DOMAIN:="$(curl -s ipinfo.io/ip).nip.io"}
export USERNAME=${USERNAME:="$(whoami)"}
export PASSWORD=${PASSWORD:=password}
export IP=${IP:="$(hostname -I | awk '{print $2}')"}
export DOMAIN=${DOMAIN:="$IP.nip.io"}
export USER_NAME=${USER_NAME:="admin"}
export PASSWORD=${PASSWORD:="password"}
export VERSION=${VERSION:="3.11"}
export SCRIPT_REPO=${SCRIPT_REPO:="https://raw.githubusercontent.com/gshipley/installcentos/master"}
export IP=${IP:="$(ip route get 8.8.8.8 | awk '{print $NF; exit}')"}
export SCRIPT_REPO=${SCRIPT_REPO:="https://raw.githubusercontent.com/cmcornejocrespo/installcentos/master"}
export API_PORT=${API_PORT:="8443"}
export METRICS="False"
export LOGGING="False"
export LETSENCRYPT=${LETSENCRYPT:="false"}
export MAIL=${MAIL:="[email protected]"}

Expand Down Expand Up @@ -72,7 +70,7 @@ fi
echo "******"
echo "* Your domain is $DOMAIN "
echo "* Your IP is $IP "
echo "* Your username is $USERNAME "
echo "* Your username is $USER_NAME "
echo "* Your password is $PASSWORD "
echo "* OpenShift version: $VERSION "
echo "* Enable HTTPS with Let's Encrypt: $LETSENCRYPT "
Expand All @@ -99,7 +97,7 @@ yum -y install epel-release
# Disable the EPEL repository globally so that is not accidentally used during later steps of the installation
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo

systemctl | grep "NetworkManager.*running"
systemctl | grep "NetworkManager.*running"
if [ $? -eq 1 ]; then
systemctl start NetworkManager
systemctl enable NetworkManager
Expand All @@ -114,28 +112,11 @@ yum -y --enablerepo=epel install ansible.rpm
[ ! -d openshift-ansible ] && git clone https://github.com/openshift/openshift-ansible.git -b release-${VERSION} --depth=1

cat <<EOD > /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
${IP} $(hostname) console console.${DOMAIN}
${IP} $(hostname) console console.${DOMAIN}
EOD

if [ -z $DISK ]; then
echo "Not setting the Docker storage."
else
cp /etc/sysconfig/docker-storage-setup /etc/sysconfig/docker-storage-setup.bk

echo DEVS=$DISK > /etc/sysconfig/docker-storage-setup
echo VG=DOCKER >> /etc/sysconfig/docker-storage-setup
echo SETUP_LVM_THIN_POOL=yes >> /etc/sysconfig/docker-storage-setup
echo DATA_SIZE="100%FREE" >> /etc/sysconfig/docker-storage-setup

systemctl stop docker

rm -rf /var/lib/docker
wipefs --all $DISK
docker-storage-setup
fi

systemctl restart docker
systemctl enable docker

Expand All @@ -145,9 +126,6 @@ if [ ! -f ~/.ssh/id_rsa ]; then
ssh -o StrictHostKeyChecking=no root@$IP "pwd" < /dev/null
fi

export METRICS="True"
export LOGGING="True"

memory=$(cat /proc/meminfo | grep MemTotal | sed "s/MemTotal:[ ]*\([0-9]*\) kB/\1/")

if [ "$memory" -lt "4194304" ]; then
Expand Down Expand Up @@ -224,36 +202,15 @@ touch /etc/origin/master/htpasswd
ansible-playbook -i inventory.ini openshift-ansible/playbooks/prerequisites.yml
ansible-playbook -i inventory.ini openshift-ansible/playbooks/deploy_cluster.yml

htpasswd -b /etc/origin/master/htpasswd ${USERNAME} ${PASSWORD}
oc adm policy add-cluster-role-to-user cluster-admin ${USERNAME}

if [ "$PVS" = "true" ]; then

curl -o vol.yaml $SCRIPT_REPO/vol.yaml

for i in `seq 1 200`;
do
DIRNAME="vol$i"
mkdir -p /mnt/data/$DIRNAME
chcon -Rt svirt_sandbox_file_t /mnt/data/$DIRNAME
chmod 777 /mnt/data/$DIRNAME

sed "s/name: vol/name: vol$i/g" vol.yaml > oc_vol.yaml
sed -i "s/path: \/mnt\/data\/vol/path: \/mnt\/data\/vol$i/g" oc_vol.yaml
oc create -f oc_vol.yaml
echo "created volume $i"
done
rm oc_vol.yaml
fi
htpasswd -b /etc/origin/master/htpasswd ${USER_NAME} ${PASSWORD}
oc adm policy add-cluster-role-to-user cluster-admin ${USER_NAME}

echo "******"
echo "* Your console is https://console.$DOMAIN:$API_PORT"
echo "* Your username is $USERNAME "
echo "* Your username is $USER_NAME "
echo "* Your password is $PASSWORD "
echo "*"
echo "* Login using:"
echo "*"
echo "$ oc login -u ${USERNAME} -p ${PASSWORD} https://console.$DOMAIN:$API_PORT/"
echo "******"

oc login -u ${USERNAME} -p ${PASSWORD} https://console.$DOMAIN:$API_PORT/
echo "$ oc login -u ${USER_NAME} -p ${PASSWORD} https://console.$DOMAIN:$API_PORT/ --insecure-skip-tls-verify"
echo "******"
94 changes: 47 additions & 47 deletions inventory.ini
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
[OSEv3:children]
masters
nodes
etcd
[masters]
${IP} openshift_ip=${IP} openshift_schedulable=true
[etcd]
${IP} openshift_ip=${IP}
[nodes]
${IP} openshift_ip=${IP} openshift_schedulable=true openshift_node_group_name="node-config-all-in-one"
[OSEv3:vars]
openshift_additional_repos=[{'id': 'centos-paas', 'name': 'centos-paas', 'baseurl' :'https://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin311', 'gpgcheck' :'0', 'enabled' :'1'}]
ansible_ssh_user=root
enable_excluders=False
enable_docker_excluder=False
ansible_service_broker_install=False
containerized=True
os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability
deployment_type=origin
openshift_deployment_type=origin
template_service_broker_selector={"region":"infra"}
openshift_metrics_image_version="v${VERSION}"
openshift_logging_image_version="v${VERSION}"
openshift_logging_elasticsearch_proxy_image_version="v1.0.0"
openshift_logging_es_nodeselector={"node-role.kubernetes.io/infra":"true"}
logging_elasticsearch_rollout_override=false
osm_use_cockpit=true
openshift_metrics_install_metrics=${METRICS}
openshift_logging_install_logging=${LOGGING}
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_master_htpasswd_file='/etc/origin/master/htpasswd'
openshift_public_hostname=console.${DOMAIN}
openshift_master_default_subdomain=apps.${DOMAIN}
openshift_master_api_port=${API_PORT}
openshift_master_console_port=${API_PORT}
[OSEv3:children]
masters
nodes
etcd

[masters]
${IP} openshift_ip=${IP} openshift_schedulable=true

[etcd]
${IP} openshift_ip=${IP}

[nodes]
${IP} openshift_ip=${IP} openshift_schedulable=true openshift_node_group_name="node-config-all-in-one"

[OSEv3:vars]
openshift_additional_repos=[{'id': 'centos-paas', 'name': 'centos-paas', 'baseurl' :'https://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin311', 'gpgcheck' :'0', 'enabled' :'1'}]

ansible_ssh_user=root
enable_excluders=False
enable_docker_excluder=False
ansible_service_broker_install=False

containerized=True
os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability

deployment_type=origin
openshift_deployment_type=origin

template_service_broker_selector={"region":"infra"}
openshift_metrics_image_version="v${VERSION}"
openshift_logging_image_version="v${VERSION}"
openshift_logging_elasticsearch_proxy_image_version="v1.0.0"
openshift_logging_es_nodeselector={"node-role.kubernetes.io/infra":"true"}
logging_elasticsearch_rollout_override=false
osm_use_cockpit=true

openshift_metrics_install_metrics=${METRICS}
openshift_logging_install_logging=${LOGGING}

openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_master_htpasswd_file='/etc/origin/master/htpasswd'

openshift_public_hostname=console.${DOMAIN}
openshift_master_default_subdomain=apps.${DOMAIN}
openshift_master_api_port=${API_PORT}
openshift_master_console_port=${API_PORT}
8 changes: 0 additions & 8 deletions user-custom-exports.sh

This file was deleted.

35 changes: 0 additions & 35 deletions validate/do.tf

This file was deleted.

3 changes: 0 additions & 3 deletions validate/run.sh

This file was deleted.

11 changes: 0 additions & 11 deletions validate/start.sh

This file was deleted.

5 changes: 0 additions & 5 deletions validate/stop.sh

This file was deleted.

11 changes: 0 additions & 11 deletions validate/validate.sh

This file was deleted.

13 changes: 0 additions & 13 deletions vol.yaml

This file was deleted.