ansible/roles/ocp-workload-3scale-multitenant/readme.adoc
@@ -54,11 +54,13 @@ # Delete REMOVE_TENANTS_ONLY=true ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" \ -e"subdomain_base=$SUBDOMAIN_BASE" -e"subdomain_base=$SUBDOMAIN_BASE" \ -e"REMOVE_TENANTS_ONLY=$REMOVE_TENANTS_ONLY" ----- ----- ansible/roles/ocp-workload-3scale-multitenant/tasks/remove_workload.yml
@@ -15,16 +15,18 @@ - "start and end tenants = {{start_tenant}} {{end_tenant}}" - "create API Gateways for each tenant = {{create_gws_with_each_tenant}}" - name: Copy tenant provisioning script to known path - name: Copy tenant provisioning script to known path; REMOVE_TENANTS_ONLY = {{REMOVE_TENANTS_ONLY}} template: src: templates/manage_tenants.sh dest: /tmp/manage_tenants.sh mode: 0755 vars: create_tenants: "false" when: REMOVE_TENANTS_ONLY|d(False)|bool - name: Remove tenants shell: "/tmp/manage_tenants.sh" ignore_errors: true when: REMOVE_TENANTS_ONLY|d(False)|bool ############################################## ansible/roles/ocp-workload-3scale-multitenant/templates/manage_tenants.sh
@@ -27,6 +27,12 @@ echo -en "\n\nCreating tenants $startTenant through $endTenant \n" > $log_file echo -en "GUID\tOCP user id\tOCP user passwd\t3scale admin URL\tAPI admin Id\tAPI admin passwd\tAPI admin access token\n\t\t\t\t\t" > $user_info_file which xmlstarlet if [ $? -ne 0 ];then echo -en "\n *** ERROR: 0 Need to install xmlstarlet utility" >> $log_file exit 1; fi curl -o $output_dir/3scale-apicast.yml https://raw.githubusercontent.com/gpe-mw-training/3scale_onpremise_implementation_labs/master/resources/rhte/3scale-apicast.yml ansible/roles/ocp-workload-istio-community/readme.adoc
@@ -18,14 +18,12 @@ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=create" \ -e"ocp_user_needs_quota=${NEEDS_QUOTA}" \ ansible-playbook -i localhost, -c local ./configs/ocp-workloads/ocp-workload.yml \ -e"ANSIBLE_REPO_PATH=`pwd`" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"ACTION=remove" ansible/roles/ocp-workload-istio-community/tasks/pre_workload.yml
@@ -1,10 +1,10 @@ --- # - name: Add user to developer group (allowed to create projects) # shell: "oadm groups add-users {{item}} {{ocp_username}}" # shell: "oadm groups add-users {{item}} {{admin_username}}" # register: groupadd_register # with_items: "{{ocp_user_groups}}" # when: ocp_username is defined and ocp_user_groups is defined # when: admin_username is defined and ocp_user_groups is defined # # - name: test that command worked # debug: @@ -13,8 +13,8 @@ - name: Create user Quota - clusterresourcequota shell: | oc create clusterquota clusterquota-"{{ocp_username}}-{{lab_name}}" \ --project-annotation-selector=openshift.io/requester="{{ocp_username}}" \ oc create clusterquota clusterquota-"{{admin_username}}-{{lab_name}}" \ --project-annotation-selector=openshift.io/requester="{{admin_username}}" \ --hard requests.cpu="{{quota_requests_cpu}}" \ --hard limits.cpu="{{quota_limits_cpu}}" \ --hard requests.memory="{{quota_requests_memory}}" \ ansible/roles/ocp-workload-istio-community/tasks/remove_workload.yml
@@ -3,8 +3,8 @@ debug: msg: "Pre-Software checks completed successfully - Removed" - name: Remove user Quota - oc delete clusterresourcequota "clusterquota-{{ocp_username}}-{{lab_name}}" shell: oc delete clusterresourcequota clusterquota-{{ocp_username}}-{{lab_name}} - name: Remove user Quota - oc delete clusterresourcequota "clusterquota-{{admin_username}}-{{lab_name}}" shell: oc delete clusterresourcequota clusterquota-{{admin_username}}-{{lab_name}} ignore_errors: true - name: Remove any lingering tmp files ansible/roles/ocp-workload-istio-community/tasks/workload.yml
@@ -63,10 +63,10 @@ command: "oc label namespace {{ocp_project}} AAD='{{lab_name}}'" - name: Annotate the empty project as requested by user shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{ocp_username}} --overwrite" shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{admin_username}} --overwrite" - name: Give ocp_username access to ocp_project; user = {{ocp_username}} shell: "oc policy add-role-to-user admin {{ocp_username}} -n {{ocp_project}}" - name: Give admin_username access to ocp_project; user = {{admin_username}} shell: "oc policy add-role-to-user admin {{admin_username}} -n {{ocp_project}}" - name: workload Tasks Complete debug: