ansible/roles/ocp4-workload-tektoncd-foundations/defaults/main.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/files/pipelines-subscription.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/readme.adoc | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/tasks/main.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/tasks/post_workload.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/tasks/pre_workload.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/tasks/remove_workload.yml | ●●●●● patch | view | raw | blame | history | |
ansible/roles/ocp4-workload-tektoncd-foundations/tasks/workload.yml | ●●●●● patch | view | raw | blame | history |
ansible/roles/ocp4-workload-tektoncd-foundations/defaults/main.yml
New file @@ -0,0 +1,15 @@ --- become_override: False ocp_username: opentlc-mgr silent: False _tekton_version: 0.6.0 _tekton_cli_url: "https://github.com/tektoncd/cli/releases/download/v{{ _tekton_version }}/tkn_{{ _tekton_version }}_Linux_x86_64.tar.gz" _yq_version: 2.4.1 _yq_cli_url: "https://github.com/mikefarah/yq/releases/download/{{ _yq_version }}/yq_linux_amd64" _knative_version: 0.12.0 _knative_cli_url: "https://github.com/knative/client/releases/download/v{{ _knative_version }}/kn-linux-amd64" _rhd_infra_project: rhd-workshop-infra ansible/roles/ocp4-workload-tektoncd-foundations/files/pipelines-subscription.yml
New file @@ -0,0 +1,11 @@ --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: openshift-pipelines namespace: openshift-operators spec: channel: dev-preview source: community-operators name: openshift-pipelines-operator sourceNamespace: openshift-marketplace ansible/roles/ocp4-workload-tektoncd-foundations/readme.adoc
New file @@ -0,0 +1,68 @@ = ocp4-workload-tektoncd-foundations - Tekton Foundations == Role overview * This role is used to prepare an environment for working through the foundations of link:https://tekton.dev[Tekton]. ** Playbook: link:./tasks/pre_workload.yml[pre_workload.yml] - Sets up an environment for the workload deployment *** Debug task will print out: `pre_workload Tasks completed successfully.` ** Playbook: link:./tasks/workload.yml[workload.yml] - Used to deploy the actual workload, i.e, 3scale, Mobile or some Demo *** This role only prints the current username for which this role is provisioning. *** Debug task will print out: `workload Tasks completed successfully.` ** Playbook: link:./tasks/post_workload.yml[post_workload.yml] - Used to configure the workload after deployment *** This role doesn't do anything here *** Debug task will print out: `post_workload Tasks completed successfully.` ** Playbook: link:./tasks/remove_workload.yml[remove_workload.yml] - Used to delete the workload *** This role doesn't do anything here *** Debug task will print out: `remove_workload Tasks completed successfully.` == Review the defaults variable file * This file link:./defaults/main.yml[./defaults/main.yml] contains all the variables you need to define to control the deployment of your workload. * The variable *ocp_username* is mandatory to assign the workload to the correct OpenShift user. * A variable *silent=True* can be passed to suppress debug messages. * You can modify any of these default values by adding `-e "variable_name=variable_value"` to the command line === Deploy a Workload with the `ocp-workload` playbook [Mostly for testing] ---- TARGET_HOST="bastion.na39.openshift.opentlc.com" OCP_USERNAME=$(whoami) WORKLOAD="ocp4-workload-tektoncd-foundations" GUID=$(hostname | cut -d\. -f2) # 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/keytoyourhost.pem" \ -e"ansible_user=ec2-user" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"silent=False" \ -e"guid=${GUID}" \ -e"ACTION=create" ---- === To Delete an environment ---- TARGET_HOST="bastion.na39.openshift.opentlc.com" OCP_USERNAME=$(whoami) WORKLOAD="ocp4-workload-tektoncd-foundations" GUID=$(hostname | cut -d\. -f2) # 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/keytoyourhost.pem" \ -e"ansible_user=ec2-user" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"silent=False" \ -e"guid=${GUID}" \ -e"ACTION=remove" ---- ansible/roles/ocp4-workload-tektoncd-foundations/tasks/main.yml
New file @@ -0,0 +1,30 @@ --- # Do not modify this file - name: Running Pre Workload Tasks include_tasks: file: ./pre_workload.yml apply: become: "{{ become_override | bool }}" when: ACTION == "create" or ACTION == "provision" - name: Running Workload Tasks include_tasks: file: ./workload.yml apply: become: "{{ become_override | bool }}" when: ACTION == "create" or ACTION == "provision" - name: Running Post Workload Tasks include_tasks: file: ./post_workload.yml apply: become: "{{ become_override | bool }}" when: ACTION == "create" or ACTION == "provision" - name: Running Workload removal Tasks include_tasks: file: ./remove_workload.yml apply: become: "{{ become_override | bool }}" when: ACTION == "destroy" or ACTION == "remove" ansible/roles/ocp4-workload-tektoncd-foundations/tasks/post_workload.yml
New file @@ -0,0 +1,24 @@ --- # Implement your Post Workload deployment tasks here # Leave these as the last tasks in the playbook # For deployment onto a dedicated cluster (as part of the # cluster deployment) set workload_shared_deployment to False # This is the default so it does not have to be set explicitely - name: pre_workload tasks complete debug: msg: "Post-Workload tasks completed successfully." when: - not silent|bool - not workload_shared_deployment|d(False) # For RHPDS deployment (onto a shared cluster) set # workload_shared_deployment to True # (in the deploy script or AgnosticV configuration) - name: pre_workload tasks complete debug: msg: "Post-Software checks completed successfully" when: - not silent|bool - workload_shared_deployment|d(False) ansible/roles/ocp4-workload-tektoncd-foundations/tasks/pre_workload.yml
New file @@ -0,0 +1,24 @@ --- # Implement your Pre Workload deployment tasks here # Leave these as the last tasks in the playbook # For deployment onto a dedicated cluster (as part of the # cluster deployment) set workload_shared_deployment to False # This is the default so it does not have to be set explicitely - name: pre_workload tasks complete debug: msg: "Pre-Workload tasks completed successfully." when: - not silent|bool - not workload_shared_deployment|d(False) # For RHPDS deployment (onto a shared cluster) set # workload_shared_deployment to True # (in the deploy script or AgnosticV configuration) - name: pre_workload tasks complete debug: msg: "Pre-Software checks completed successfully" when: - not silent|bool - workload_shared_deployment|d(False) ansible/roles/ocp4-workload-tektoncd-foundations/tasks/remove_workload.yml
New file @@ -0,0 +1,35 @@ --- # Implement your Workload removal tasks here - name: Check for openshift-pipelines Subscription k8s_info: api_version: operators.coreos.com/v1alpha1 kind: Subscription name: openshift-pipelines namespace: openshift-operators register: openshift_pipelines_subscription - name: Remove openshift-pipelines Resources block: - name: Remove an existing Service object k8s: state: absent api_version: operators.coreos.com/v1alpha1 kind: Subscription namespace: openshift-operators name: openshift-pipelines - name: Remove openshift-pipelines ClusterServiceVersion k8s: state: absent api_version: operators.coreos.com/v1alpha1 kind: ClusterServiceVersion namespace: openshift-operators name: "{{ openshift_pipelines_subscription.resources[0].status.installedCSV }}" when: ('resources' in openshift_pipelines_subscription) and openshift_pipelines_subscription.resources | list | length == 1 # Leave this as the last task in the playbook. - name: remove_workload tasks complete debug: msg: "Remove Workload tasks completed successfully." when: not silent|bool ansible/roles/ocp4-workload-tektoncd-foundations/tasks/workload.yml
New file @@ -0,0 +1,80 @@ --- # Implement your Workload deployment tasks here - name: Setting up workload for user debug: msg: "Setting up workload for user ocp_username = {{ ocp_username }}" - name: Install tekton CLI (tkn) become: yes unarchive: src: "{{ _tekton_cli_url }}" remote_src: yes dest: /usr/local/bin mode: 0775 owner: root group: root - name: Install yq CLI become: yes get_url: url: "{{ _yq_cli_url }}" dest: /usr/local/bin/yq mode: 0775 owner: root group: root - name: Install knative CLI (kn) become: yes get_url: url: "{{ _knative_cli_url }}" dest: /usr/local/bin/kn mode: 0775 owner: root group: root - name: Install OpenShift Pipelines k8s: state: present definition: "{{ lookup('file', './files/pipelines-subscription.yml') }}" tags: - pipelines - name: Wait until OpenShift Pipelines Operator CRD is installed k8s_info: api_version: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition name: config.operator.tekton.dev ignore_errors: yes delay: 10 register: tekton_operator_crd retries: 20 until: tekton_operator_crd.resources | list | length == 1 - name: Wait until OpenShift Pipelines is installed become: yes k8s_info: api_version: operator.tekton.dev/v1alpha1 kind: Config name: cluster ignore_errors: yes delay: 10 register: tekton_cluster_config retries: 20 until: ('resources' in tekton_cluster_config) and (tekton_cluster_config.resources | list | length == 1) and (tekton_cluster_config.resources[0].status.conditions[0].code == "installed") - name: Create RHD Infra Project k8s: api_version: v1 kind: Namespace name: "{{ _rhd_infra_project }}" state: present - name: Create Nexus Repository Server shell: "oc -n {{ _rhd_infra_project }} new-app sonatype/nexus -o yaml | oc apply -n {{ _rhd_infra_project }} -f-" # Leave this as the last task in the playbook. - name: workload tasks complete debug: msg: "Workload Tasks completed successfully." when: not silent|bool