= ocp-workload-rhte-mw-op-intel

== NOTES
. Corresponds to the link:https://drive.google.com/open?id=1mppB7fFbSYzxHdLURXIUYN2FbSoUX9KquxwfW88pB-A[Operational Intelligence] Tech Exchange lab
. Using a version of oc utility that corresponds to your target OCP cluster, ensure oc utility is already authenticated as the cluster-admin:   opentlc-mgr

=== Deploy a Workload with the `ocp-workload` playbook [Mostly for testing]

----
GUID=jb45
OCP_USERNAME="jbride-redhat.com"
WORKLOAD="ocp-workload-rhte-mw-op-intel"

# a TARGET_HOST is specified in the command line, without using an inventory file
ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \
  -e"ANSIBLE_REPO_PATH=`pwd`" \
  -e"ocp_workload=${WORKLOAD}" \
  -e"ocp_username=${OCP_USERNAME}" \
  -e"guid=${GUID}" \
  -e"ocp_user_needs_quota=true" \
  -e"ocp_domain=${OCP_DOMAIN}" \
  -e"ACTION=create"

----

=== To Delete an environment
----
GUID=jb45
HOST_GUID=dev39
TARGET_HOST="master.$HOST_GUID.openshift.opentlc.com"
OCP_USERNAME="jbride-redhat.com"
WORKLOAD="ocp-workload-rhte-mw-op-intel"

# a TARGET_HOST is specified in the command line, without using an inventory file
=======
WORKLOAD="ocp-workload-rhte-mw-op-intel"
OCP_USERNAME="jbride-redhat.com"

HOST_GUID=`oc whoami --show-server | cut -d'.' -f 2`
OCP_DOMAIN=$HOST_GUID.openshift.opentlc.com

# a TARGET_HOST is specified in the command line, without using an inventory file
ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \
                    -e"ANSIBLE_REPO_PATH=`pwd`" \
                    -e"ocp_workload=${WORKLOAD}" \
                    -e"ocp_username=${OCP_USERNAME}" \
                    -e"guid=${GUID}" \
                    -e"ocp_user_needs_quota=true" \
                    -e"ocp_domain=${OCP_DOMAIN}" \
                    -e"ACTION=create"

ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \
                    -e"ANSIBLE_REPO_PATH=`pwd`" \
                    -e"ocp_workload=${WORKLOAD}" \
                    -e"guid=$GUID" \
                    -e"ACTION=remove"

----



== Execution using remote (bastion node) oc client
=== Deploy a Workload with the `ocp-workload` playbook [Mostly for testing]
----
HOST_GUID=dev39
TARGET_HOST="bastion.$HOST_GUID.openshift.opentlc.com"
WORKLOAD="ocp-workload-rhte-mw-op-intel"
SSH_USERNAME="jbride-redhat.com"
SSH_PRIVATE_KEY="id_ocp"
GUID=jb05
OCP_USERNAME="jbride-redhat.com"

# a TARGET_HOST is specified in the command line, without using an inventory file
ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \
                 -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \
                 -e"ansible_ssh_user=${SSH_USERNAME}" \
                    -e"ANSIBLE_REPO_PATH=`pwd`" \
                    -e"ocp_username=${OCP_USERNAME}" \
                    -e"ocp_workload=${WORKLOAD}" \
                    -e"guid=${GUID}" \
                    -e"ocp_domain=$HOST_GUID.openshift.opentlc.com" \
                    -e"ACTION=create"

----

=== To Delete an environment
----
HOST_GUID=dev39
TARGET_HOST="bastion.$HOST_GUID.openshift.opentlc.com"
WORKLOAD="ocp-workload-rhte-mw-op-intel"
GUID=jb05
OCP_USERNAME="jbride-redhat.com"

# a TARGET_HOST is specified in the command line, without using an inventory file
ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \
                    -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \
                    -e"ansible_ssh_user=${SSH_USERNAME}" \
                    -e"ANSIBLE_REPO_PATH=`pwd`" \
                    -e"ocp_username=${OCP_USERNAME}" \
                    -e"ocp_workload=${WORKLOAD}" \
                    -e"guid=${GUID}" \
                    -e"ACTION=remove"
----
