Skip to content

Commit

Permalink
IDMEDG Automation Release 3.1 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdr2 authored Jul 28, 2022
1 parent c3c0dbb commit 413cdb8
Show file tree
Hide file tree
Showing 52 changed files with 2,581 additions and 413 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,9 @@ create_ldap_entries()
update_variable "<LDAP_ADMIN_USER>" $LDAP_ADMIN_USER $shfile
update_variable "<LDAP_ADMIN_PWD>" $LDAP_ADMIN_PWD $shfile

kubectl cp $filename $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input
kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -- /u01/oracle/config-input/oud_add_users.sh > $LOGDIR/create_ldap.log 2>&1
kubectl cp $filename $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input > $LOGDIR/create_ldap.log 2>&1
kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input >> $LOGDIR/create_ldap.log 2>&1
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -c oud-ds-rs -- /u01/oracle/config-input/oud_add_users.sh >> $LOGDIR/create_ldap.log 2>&1
fi

if [ $? -gt 0 ]
Expand Down Expand Up @@ -576,8 +576,8 @@ add_existing_users()
update_variable "<OAA_ADMIN_USER>" $OAA_ADMIN_USER $shfile
update_variable "<OAA_USER_GROUP>" $OAA_USER_GROUP $shfile

kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -- /u01/oracle/config-input/oud_add_existing_users.sh > $LOGDIR/add_existing_users.log 2>&1
kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input > $LOGDIR/add_existing_users.log 2>&1
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -c oud-ds-rs -- /u01/oracle/config-input/oud_add_existing_users.sh >> $LOGDIR/add_existing_users.log 2>&1
fi

if [ $? -gt 0 ]
Expand Down Expand Up @@ -767,6 +767,32 @@ create_ohs_wallet()
ET=`date +%s`
print_time STEP "Create OHS Wallet" $ST $ET >> $LOGDIR/timings.log
}

# Deploy Coherence
#
deploy_coherence()
{
print_msg "Deploy Coherence"
ST=`date +%s`

printf "\n\t\t\tAdd Coherence Repository - "
helm repo add coherence https://oracle.github.io/coherence-operator/charts > $LOGDIR/deploy_coherence.log 2>&1
print_status $? $LOGDIR/deploy_coherence.log

printf "\t\t\tUpdate Helm Repository - "
helm repo update >> $LOGDIR/deploy_coherence.log 2>&1
print_status $? $LOGDIR/deploy_coherence.log


printf "\t\t\tInstall Coherence - "
helm install -n $OAACONS coherence-operator coherence/coherence-operator >> $LOGDIR/deploy_coherence.log 2>&1
print_status $? $LOGDIR/deploy_coherence.log


ET=`date +%s`
print_time STEP "Deploy Coherence" $ST $ET >> $LOGDIR/timings.log
}

# Deploy OAA
#
deploy_oaa()
Expand Down Expand Up @@ -1259,9 +1285,9 @@ create_test_user()
update_variable "<LDAP_ADMIN_USER>" $LDAP_ADMIN_USER $shfile
update_variable "<LDAP_ADMIN_PWD>" $LDAP_ADMIN_PWD $shfile

kubectl cp $filename $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input
kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -- /u01/oracle/config-input/oud_test_user.sh > $LOGDIR/create_test_user.log 2>&1
kubectl cp $filename $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input > $LOGDIR/create_test_user.log 2>&1
kubectl cp $shfile $OUDNS/$OUD_POD_PREFIX-oud-ds-rs-0:/u01/oracle/config-input >> $LOGDIR/create_test_user.log 2>&1
kubectl exec -ti -n $OUDNS $OUD_POD_PREFIX-oud-ds-rs-0 -c oud-ds-rs -- /u01/oracle/config-input/oud_test_user.sh >> $LOGDIR/create_test_user.log 2>&1
fi

if [ $? -gt 0 ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ run_idmConfigTool()
if [ $? = 0 ]
then
echo "Failed - Check logifle $WORKDIR/logs/configoam.log"
echo "SEVERE Error Message Detected." >> $WORKDIR/logs/configoam.log
exit 1
else
echo "Success"
Expand Down Expand Up @@ -687,11 +688,11 @@ create_oam_ohs_config()

print_msg "Creating OHS Config Files"
OHS_PATH=$LOCAL_WORKDIR/OHS
if [ ! -d $OHS_PATH/OHS/$OHS_HOST1 ]
if [ ! -d $OHS_PATH/$OHS_HOST1 ]
then
mkdir -p $OHS_PATH/$OHS_HOST1
fi
if [ ! -d $OHS_PATH/OHS/$OHS_HOST2 ]
if [ ! -d $OHS_PATH/$OHS_HOST2 ]
then
mkdir -p $OHS_PATH/$OHS_HOST2
fi
Expand Down Expand Up @@ -728,35 +729,12 @@ create_oam_ohs_config()
fi
fi

if [ ! "$OHS_HOST2" = "" ]
if [ ! "$OHS_HOST2" = "" ]
then
cp $TEMPLATE_DIR/iadadmin_vh.conf $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
cp $TEMPLATE_DIR/login_vh.conf $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<OHS_HOST>" $OHS_HOST2 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OHS_PORT>" $OHS_PORT $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_ADMIN_LBR_HOST>" $OAM_ADMIN_LBR_HOST $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_ADMIN_LBR_PORT>" $OAM_ADMIN_LBR_PORT $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<K8_WORKER_HOST1>" $K8_WORKER_HOST1 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<K8_WORKER_HOST2>" $K8_WORKER_HOST2 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OHS_HOST>" $OHS_HOST2 $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<OHS_PORT>" $OHS_PORT $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<OAM_LOGIN_LBR_PROTOCOL>" $OAM_LOGIN_LBR_PROTOCOL $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<OAM_LOGIN_LBR_HOST>" $OAM_LOGIN_LBR_HOST $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<OAM_LOGIN_LBR_PORT>" $OAM_LOGIN_LBR_PORT $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<K8_WORKER_HOST1>" $K8_WORKER_HOST1 $OHS_PATH/$OHS_HOST2/login_vh.conf
update_variable "<K8_WORKER_HOST2>" $K8_WORKER_HOST2 $OHS_PATH/$OHS_HOST2/login_vh.conf
if [ "$USE_INGRESS" = "true" ]
then
update_variable "<OAM_ADMIN_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_POLICY_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_OAM_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_OAM_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/login_vh.conf
else
update_variable "<OAM_ADMIN_K8>" $OAM_ADMIN_K8 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_POLICY_K8>" $OAM_POLICY_K8 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_OAM_K8>" $OAM_OAM_K8 $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
update_variable "<OAM_OAM_K8>" $OAM_OAM_K8 $OHS_PATH/$OHS_HOST2/login_vh.conf
fi
cp $OHS_PATH/$OHS_HOST1/iadadmin_vh.conf $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
cp $OHS_PATH/$OHS_HOST1/login_vh.conf $OHS_PATH/$OHS_HOST2/login_vh.conf
sed -i "s/$OHS_HOST1/$OHS_HOST2/" $OHS_PATH/$OHS_HOST2/login_vh.conf
sed -i "s/$OHS_HOST1/$OHS_HOST2/" $OHS_PATH/$OHS_HOST2/iadadmin_vh.conf
fi

print_status $?
Expand All @@ -780,3 +758,32 @@ copy_wg_files()
ET=`date +%s`
print_time STEP "Copy Webgate Artifacts to $LOCAL_WORKDIR/OHS/webgate" $ST $ET >> $LOGDIR/timings.log
}

# Create logstash configmap
#
create_logstash_cm()
{
ST=`date +%s`
print_msg "Creating logstash Config Map"
cp $TEMPLATE_DIR/logstash_cm.yaml $WORKDIR

update_variable "<OAMNS>" $OAMNS $WORKDIR/logstash_cm.yaml
update_variable "<ELK_HOST>" $ELK_HOST $WORKDIR/logstash_cm.yaml
update_variable "<ELK_USER_PWD>" $ELK_USER_PWD $WORKDIR/logstash_cm.yaml

kubectl create -f $WORKDIR/logstash_cm.yaml >$LOGDIR/logstash_cm.log 2>&1
if [ $? = 0 ]
then
echo "Success"
else
grep -q "AlreadyExists" $LOGDIR/logstash_cm.log
if [ $? = 0 ]
then
echo "Already Exists"
else
print_status 1 $LOGDIR/logstash_cm.log
fi
fi
ET=`date +%s`
print_time STEP "Create Logstash Config Map" $ST $ET >> $LOGDIR/timings.log
}
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ copy_connector()
ST=`date +%s`
print_msg "Installing Connector into Container"

printf "\n\t\t\tCheck Connector Exists - "
if [ -d $CONNECTOR_DIR/OID-12.2.1* ]
then
echo "Success"
else
echo " Connector Bundle not found. Please download and stage before continuing"
exit 1
fi

kubectl exec -ti $OIG_DOMAIN_NAME-oim-server1 -n $OIGNS -- mkdir -p /u01/oracle/user_projects/domains/ConnectorDefaultDirectory
if ! [ "$?" = "0" ]
Expand All @@ -264,6 +272,7 @@ copy_connector()
exit 1
fi

printf "\n\t\t\tCopy Connector to container - "
kubectl cp $CONNECTOR_DIR/OID-12.2* $OIGNS/$OIG_DOMAIN_NAME-adminserver:/u01/oracle/user_projects/domains/ConnectorDefaultDirectory
print_status $?

Expand Down Expand Up @@ -542,8 +551,8 @@ generate_parameter_files()
run_command_k8 $OIGNS $OIG_DOMAIN_NAME "chmod 750 /u01/oracle/idm/server/ssointg/bin/OIGOAMIntegration.sh"
run_command_k8 $OIGNS $OIG_DOMAIN_NAME "chmod 750 /u01/oracle/idm/server/ssointg/bin/_OIGOAMIntegration.sh"
run_command_k8 $OIGNS $OIG_DOMAIN_NAME "chmod 750 $PV_MOUNT/workdir/get_passphrase.sh"
run_command_k8 $OIGNS $OIG_DOMAIN_NAME "$PV_MOUNT/workdir/get_passphrase.sh"
print_status $?
run_command_k8 $OIGNS $OIG_DOMAIN_NAME "$PV_MOUNT/workdir/get_passphrase.sh" >> $LOGDIR/get_passphrase.log 2>&1
print_status $? $LOGDIR/get_passphrase.log

printf "\t\t\tEdit Integration File - "
fi
Expand Down Expand Up @@ -856,7 +865,7 @@ create_oig_ohs_config()
then
mkdir -p $OHS_PATH/$OHS_HOST1
fi
if ! [ -d $OHS_PATH/OHS/$OHS_HOST2 ]
if ! [ -d $OHS_PATH/$OHS_HOST2 ]
then
mkdir -p $OHS_PATH/$OHS_HOST2
fi
Expand Down Expand Up @@ -909,54 +918,47 @@ create_oig_ohs_config()

fi

if [ ! "$OHS_HOST2" = "" ]
if [ ! "$OHS_HOST2" = "" ]
then
cp $TEMPLATE_DIR/igdadmin_vh.conf $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
cp $TEMPLATE_DIR/prov_vh.conf $OHS_PATH/$OHS_HOST2/prov_vh.conf
cp $TEMPLATE_DIR/igdinternal_vh.conf $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OHS_HOST>" $OHS_HOST2 $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<OHS_PORT>" $OHS_PORT $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<OIG_ADMIN_LBR_HOST>" $OIG_ADMIN_LBR_HOST $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<OIG_ADMIN_LBR_PORT>" $OIG_ADMIN_LBR_PORT $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<K8_WORKER_HOST1>" $K8_WORKER_HOST1 $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<K8_WORKER_HOST2>" $K8_WORKER_HOST2 $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf

update_variable "<OHS_HOST>" $OHS_HOST2 $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OHS_PORT>" $OHS_PORT $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_LBR_PROTOCOL>" $OIG_LBR_PROTOCOL $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_LBR_HOST>" $OIG_LBR_HOST $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_LBR_PORT>" $OIG_LBR_PORT $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<K8_WORKER_HOST1>" $K8_WORKER_HOST1 $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<K8_WORKER_HOST2>" $K8_WORKER_HOST2 $OHS_PATH/$OHS_HOST2/prov_vh.conf

update_variable "<OHS_HOST>" $OHS_HOST2 $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OHS_PORT>" $OHS_PORT $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_LBR_INT_PROTOCOL>" $OIG_LBR_INT_PROTOCOL $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_LBR_INT_HOST>" $OIG_LBR_INT_HOST $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_LBR_INT_PORT>" $OIG_LBR_INT_PORT $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<K8_WORKER_HOST1>" $K8_WORKER_HOST1 $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<K8_WORKER_HOST2>" $K8_WORKER_HOST2 $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf

if [ "$USE_INGRESS" = "true" ]
then
update_variable "<OIG_OIM_PORT_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<OIG_OIM_PORT_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_SOA_PORT_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_OIM_PORT_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_SOA_PORT_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_ADMIN_K8>" $INGRESS_HTTP_PORT $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
else
update_variable "<OIG_OIM_PORT_K8>" $OIG_OIM_PORT_K8 $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
update_variable "<OIG_OIM_PORT_K8>" $OIG_OIM_PORT_K8 $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_SOA_PORT_K8>" $OIG_SOA_PORT_K8 $OHS_PATH/$OHS_HOST2/prov_vh.conf
update_variable "<OIG_OIM_PORT_K8>" $OIG_OIM_PORT_K8 $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_SOA_PORT_K8>" $OIG_SOA_PORT_K8 $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
update_variable "<OIG_ADMIN_K8>" $OIG_ADMIN_K8 $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
fi
cp $OHS_PATH/$OHS_HOST1/igdadmin_vh.conf $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
cp $OHS_PATH/$OHS_HOST1/prov_vh.conf $OHS_PATH/$OHS_HOST2/prov_vh.conf
cp $OHS_PATH/$OHS_HOST1/igdinternal_vh.conf $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
sed -i "s/$OHS_HOST1/$OHS_HOST2/" $OHS_PATH/$OHS_HOST2/igdadmin_vh.conf
sed -i "s/$OHS_HOST1/$OHS_HOST2/" $OHS_PATH/$OHS_HOST2/prov_vh.conf
sed -i "s/$OHS_HOST1/$OHS_HOST2/" $OHS_PATH/$OHS_HOST2/igdinternal_vh.conf
fi

print_status $?

ET=`date +%s`
print_time STEP "Creating OHS config" $ST $ET >> $LOGDIR/timings.log
}

# Create logstash configmap
#
create_logstash_cm()
{
ST=`date +%s`
print_msg "Creating logstash Config Map"
cp $TEMPLATE_DIR/logstash_cm.yaml $WORKDIR

update_variable "<OIGNS>" $OIGNS $WORKDIR/logstash_cm.yaml
update_variable "<ELK_HOST>" $ELK_HOST $WORKDIR/logstash_cm.yaml
update_variable "<ELK_USER_PWD>" $ELK_USER_PWD $WORKDIR/logstash_cm.yaml

kubectl create -f $WORKDIR/logstash_cm.yaml >$LOGDIR/logstash_cm.log 2>&1
if [ $? = 0 ]
then
echo "Success"
else
grep -q "AlreadyExists" $LOGDIR/logstash_cm.log
if [ $? = 0 ]
then
echo "Already Exists"
else
print_status 1 $LOGDIR/logstash_cm.log
fi
fi
ET=`date +%s`
print_time STEP "Create Logstash Config Map" $ST $ET >> $LOGDIR/timings.log
}
Original file line number Diff line number Diff line change
Expand Up @@ -652,3 +652,31 @@ create_ohs_entries()
ET=`date +%s`
print_time STEP "Create OHS Entries" $ST $ET >> $LOGDIR/timings.log
}

# Create logstash configmap
#
create_logstash_cm()
{
ST=`date +%s`
print_msg "Creating logstash Config Map"
cp $TEMPLATE_DIR/logstash_cm.yaml $WORKDIR

update_variable "<OIRINS>" $OIRINS $WORKDIR/logstash_cm.yaml
update_variable "<ELK_HOST>" $ELK_HOST $WORKDIR/logstash_cm.yaml

kubectl create -f $WORKDIR/logstash_cm.yaml >$LOGDIR/logstash_cm.log 2>&1
if [ $? = 0 ]
then
echo "Success"
else
grep -q "AlreadyExists" $LOGDIR/logstash_cm.log
if [ $? = 0 ]
then
echo "Already Exists"
else
print_status 1 $LOGDIR/logstash_cm.log
fi
fi
ET=`date +%s`
print_time STEP "Create Logstash Config Map" $ST $ET >> $LOGDIR/timings.log
}
Loading

0 comments on commit 413cdb8

Please sign in to comment.