forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2 new workloads for existing OPEN courses: "EAP 7 Development" and "A…
…MQ Streams Foundations" (redhat-cop#1156) * https://github.com/redhat-gpe/3scale_implementation/issues/191 * https://github.com/redhat-gpe/eap_dev_7/issues/28 * https://github.com/redhat-gpe/amq_streams_foundations/issues/37 * https://github.com/redhat-gpe/eap_dev_7/issues/28
- Loading branch information
Showing
11 changed files
with
232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
= eap7-dev | ||
|
||
== NOTES | ||
|
||
. This workload provisions a VM runs on RHEL 7, for use in the *EAP 7 Development* course | ||
. The VM contains the following software that will be used as part of the labs in the course: | ||
.. curl utility | ||
.. EAP 7 | ||
.. Apache Maven 3.6.3 | ||
.. JDK 1.8 | ||
|
||
== Accessing the VM | ||
|
||
. Provision the VM through labs.opentlc.com | ||
. SSH into the VM | ||
. Execute command `sudo jboss` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
student_user: jboss | ||
student_sudo: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
######################### Install Software Packages | ||
|
||
- name: Install Software Packages | ||
import_tasks: ./packages.yml | ||
tags: | ||
- install_software_packages | ||
|
||
- file: | ||
path: "/home/{{student_user}}" | ||
state: directory | ||
owner: "{{student_user}}" | ||
mode: 0755 | ||
|
||
- file: | ||
path: "/srv" | ||
state: directory | ||
owner: "{{student_user}}" | ||
mode: 0755 | ||
|
||
- name: download apache-maven-3.6.3 | ||
ignore_errors: true | ||
get_url: | ||
url: https://gpte-public.s3.amazonaws.com/apache-maven-3.6.3-bin.tar.gz | ||
dest: /opt | ||
mode: 0440 | ||
|
||
- name: download jq-linux64 | ||
ignore_errors: true | ||
get_url: | ||
url: https://gpte-public.s3.amazonaws.com/jq-linux64 | ||
dest: /home/jboss | ||
mode: 0440 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#vim: set ft=ansible: | ||
--- | ||
- name: install software packages | ||
yum: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: | ||
- git | ||
- zip | ||
- bzip2 | ||
- unzip | ||
- gettext | ||
- wget | ||
- curl | ||
- telnet | ||
- tree | ||
- bind-utils | ||
- device-mapper-libs | ||
- device-mapper-event-libs | ||
- java-1.8.0-openjdk-devel | ||
tags: | ||
- install_software_packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
become_override: true | ||
ocp_username: admin | ||
ocp_user_needs_quota: True | ||
|
||
ocp_user_groups: | ||
- OPENTLC-PROJECT-PROVISIONERS | ||
|
||
quota_requests_cpu: 5 | ||
quota_limits_cpu: 10 | ||
|
||
quota_requests_memory: '6Gi' | ||
quota_limits_memory: '20Gi' | ||
|
||
quota_configmaps: 10 | ||
quota_pods: 20 | ||
quota_persistentvolumeclaims: 20 | ||
quota_services: 30 | ||
quota_secrets: 30 | ||
quota_requests_storage: 50Gi | ||
|
||
admin_user: admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
= ocp-workload-amq-streams | ||
|
||
== Overview | ||
|
||
=== Purpose | ||
This role creates an OCP Cluster primarily for supporting elab students of the _AMQ Streams Foundations_ course. | ||
|
||
== Accessing the Cluster | ||
|
||
. Retrieve <cluster_host_name> from notification email | ||
. Use `oc` utility to login: `oc login <cluster_host_name>` | ||
|
||
== Deploy a Workload with the `ocp-workload` playbook | ||
---- | ||
GUID=admin | ||
HOST_GUID=na | ||
TARGET_HOST="bastion.$HOST_GUID.openshift.opentlc.com" | ||
OCP_USERNAME="<OPENTLC_ID>" | ||
WORKLOAD="ocp-workload-amq-streams" | ||
SSH_USERNAME="<OPENTLC_ID>" | ||
SSH_PRIVATE_KEY="id_ocp" | ||
# 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_user=${SSH_USERNAME}" \ | ||
-e"ocp_username=${OCP_USERNAME}" \ | ||
-e"ocp_workload=${WORKLOAD}" \ | ||
-e"guid=${GUID}" \ | ||
-e"ocp_user_needs_quota=true" \ | ||
-e"ocp_apps_domain=apps.${HOST_GUID}.openshift.opentlc.com" \ | ||
-e"ACTION=create" | ||
---- | ||
|
||
== To Delete an environment | ||
---- | ||
GUID=admin | ||
HOST_GUID=na | ||
TARGET_HOST="bastion.$HOST_GUID.openshift.opentlc.com" | ||
OCP_USERNAME="<opentlc-ID>" | ||
WORKLOAD="ocp-workload-amq-streams" | ||
SSH_USERNAME="<opentlc-ID>" | ||
SSH_PRIVATE_KEY="id_ocp" | ||
# 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_user=${SSH_USERNAME}" \ | ||
-e"ocp_username=${OCP_USERNAME}" \ | ||
-e"ocp_workload=${WORKLOAD}" \ | ||
-e"guid=${GUID}" \ | ||
-e"ACTION=remove" | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
- name: Running Pre Workload Tasks | ||
import_tasks: ./pre_workload.yml | ||
become: "{{ become_override | bool }}" | ||
when: ACTION == "create" or ACTION == "provision" | ||
|
||
- name: Running Workload Tasks | ||
import_tasks: ./workload.yml | ||
become: "{{ become_override | bool }}" | ||
when: ACTION == "create" or ACTION == "provision" | ||
|
||
|
||
- name: Running Post Workload Tasks | ||
import_tasks: ./post_workload.yml | ||
become: "{{ become_override | bool }}" | ||
when: ACTION == "create" or ACTION == "provision" | ||
|
||
- name: Running Workload removal Tasks | ||
import_tasks: ./remove_workload.yml | ||
become: "{{ become_override | bool }}" | ||
when: ACTION == "destroy" or ACTION == "remove" |
5 changes: 5 additions & 0 deletions
5
ansible/roles/ocp-workload-amq-streams/tasks/post_workload.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
|
||
- name: post_workload Tasks Complete | ||
debug: | ||
msg: "Post-Software checks completed successfully" |
32 changes: 32 additions & 0 deletions
32
ansible/roles/ocp-workload-amq-streams/tasks/pre_workload.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
- name: Add user to developer group (allowed to create projects) | ||
shell: "oadm groups add-users {{item}} {{ocp_username}}" | ||
register: groupadd_register | ||
with_items: "{{ocp_user_groups}}" | ||
when: ocp_username is defined and ocp_user_groups is defined | ||
|
||
# - name: test that command worked | ||
# debug: | ||
# var: groupadd_register | ||
# verbosity: 2 | ||
|
||
- name: Create user Quota - clusterresourcequota | ||
shell: | | ||
oc create clusterquota clusterquota-"{{ocp_username}}-{{guid}}" \ | ||
--project-annotation-selector=openshift.io/requester="{{ocp_username}}" \ | ||
--hard requests.cpu="{{quota_requests_cpu}}" \ | ||
--hard limits.cpu="{{quota_limits_cpu}}" \ | ||
--hard requests.memory="{{quota_requests_memory}}" \ | ||
--hard limits.memory="{{quota_limits_memory}}" \ | ||
--hard configmaps="{{quota_configmaps}}" \ | ||
--hard pods="{{quota_pods}}" \ | ||
--hard persistentvolumeclaims="{{quota_persistentvolumeclaims}}" \ | ||
--hard services="{{quota_services}}" \ | ||
--hard secrets="{{quota_secrets}}" \ | ||
--hard requests.storage="{{quota_requests_storage}}" | ||
ignore_errors: true | ||
|
||
- name: pre_workload Tasks Complete | ||
debug: | ||
msg: "Pre-Software checks completed successfully" |
17 changes: 17 additions & 0 deletions
17
ansible/roles/ocp-workload-amq-streams/tasks/remove_workload.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: post_workload Tasks Complete | ||
debug: | ||
msg: "Pre-Software checks completed successfully - Removed" | ||
|
||
- name: Remove user Quota - oc delete clusterresourcequota "clusterquota-{{ocp_username}}-{{guid}}" | ||
shell: oc delete clusterresourcequota clusterquota-{{ocp_username}}-{{guid}} | ||
ignore_errors: true | ||
|
||
- name: Remove user Quota - oc delete clusterresourcequota "clusterquota-{{ocp_username}}" | ||
shell: oc delete clusterresourcequota clusterquota-{{ocp_username}} | ||
ignore_errors: true | ||
|
||
|
||
- name: post_workload Tasks Complete | ||
debug: | ||
msg: "Post-Software checks completed successfully - Removed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
|
||
|
||
- name: workload Tasks Complete | ||
debug: | ||
msg: workload Tasks Complete |