ansible/roles/ocp4-workload-rhte-kubefed-app-portability/defaults/main.yml
@@ -9,12 +9,11 @@ _kubefed_operator_deployment: "kubefed-operator" _kubefed_controller_deployment: "kubefed-controller-manager" _haproxy_project: "haproxy-lb" _haproxy_project_display: "HaProxy LoadBalancer" _kubefedctl_release: "0.1.0-rc4" _cfssl_release: "R1.2" _lab_git_repo: "https://github.com/openshift/federation-dev/" _lab_git_repo_branch: "master" _lab_git_clone_dir_name: "federation-dev" _lab_git_clone_dir_name: "federation-dev" _clientvm_student_user: "student" ansible/roles/ocp4-workload-rhte-kubefed-app-portability/files/ca-config.json
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/files/ca-csr.json
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/files/mongodb-csr.json
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/readme.adoc
@@ -32,9 +32,12 @@ ** *_kubefed_project_display*: The display name of the project. Default: `OpenShift Federation` ** *_kubefed_subscription_csv*: The ClusterServiceVersion to be deployed. Default: `kubefed-operator.v0.1.0` ** *_kubefed_operator_deployment*: The KubeFed Operator Deployment name we will wait to be ready. Default: `kubefed-operator` ** *_kubefed_controller_deployment*: The KubeFed Controller Deployment name we will wait to be ready. Default: `kubefed-controller-manager` ** *_haproxy_project*: The name of the project to create and install HAProxy Load Balancer to. Default: `` ** *_haproxy_project_display*: The display name of the project. Default: `` ** *_kubefedctl_release*: The kubefedctl tool version tha will be deployed: Default: `0.1.0-rc4` ** *_cfssl_release*: The cfssl tooling version that will be deployed: Default: `R1.2` ** *_lab_git_repo*: Lab git repository where required files are present. Default: `https://github.com/openshift/federation-dev/` ** *_lab_git_repo_branch*: Lab git repository branch where required files are present. Default: `master` ** *_lab_git_clone_dir_name*: Directory that will be created for cloning the git repository. Default: `federation-dev` ** *_clientvm_student_user*: O.S user that students will use and where the repository will be cloned. Default: `student` * You can modify any of these default values by adding `-e "variable_name=variable_value"` to the command line @@ -64,7 +67,6 @@ OCP_USERNAME="mavazque-redhat.com" WORKLOAD="ocp4-workload-rhte-kubefed-app-portability" GUID=1002 # 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 \ ansible/roles/ocp4-workload-rhte-kubefed-app-portability/tasks/post_workload.yml
@@ -1,63 +1,18 @@ --- # Implement your Post Workload deployment tasks here #- name: Setting up custom facts # set_fact: # mongo_cluster1_route_hostname: "mongo-cluster1.{{ cluster1_wildcard_domain }}" # mongo_cluster2_route_hostname: "mongo-cluster2.{{ cluster2_wildcard_domain }}" # mongo_cluster3_route_hostname: "mongo-cluster3.{{ cluster3_wildcard_domain }}" - name: Ensure Lab's Git Repository is Cloned git: repo: "{{ _lab_git_repo }}" dest: "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}" dest: "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}" version: "{{ _lab_git_repo_branch }}" become: true #- name: Ensure Directory for Storing TLS Required Files Exists # file: # path: "/home/{{ ansible_user }}/mongo_tls" # state: directory #- name: Ensure TLS Required Files are Copied # copy: # src: "{{ item }}" # dest: "/home/{{ ansible_user }}/mongo_tls" # loop: # - ./files/ca-config.json # - ./files/ca-csr.json # - ./files/mongodb-csr.json #- name: Generate CA # shell: "cfssl gencert -initca ca-csr.json | cfssljson -bare ca" # args: # chdir: "/home/{{ ansible_user }}/mongo_tls" #- name: Set MongoDB Certificate SAN # set_fact: # mongo_certificate_san: "mongo,mongo.mongo,mongo.mongo.svc.cluster.local,localhost,localhost.localdomain,127.0.0.1,{{ mongo_cluster1_route_hostname }},{{ mongo_cluster2_route_hostname }},{{ mongo_cluster3_route_hostname }}" #- name: Generate the MongoDB Certificates # shell: "cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -hostname={{ mongo_certificate_san }} -profile=kubernetes mongodb-csr.json | cfssljson -bare mongodb" # args: # chdir: "/home/{{ ansible_user }}/mongo_tls" #- name: Combine MongoDB Private and Public keys # shell: "cat mongodb-key.pem mongodb.pem > mongo.pem" # args: # chdir: "/home/{{ ansible_user }}/mongo_tls" #- name: Ensure Unneeded TLS files are Removed # file: # path: "/home/{{ ansible_user }}/mongo_tls/{{ item }}" # state: absent # loop: # - ca-config.json # - ca.csr # - ca-csr.json # - ca-key.pem # - mongodb.csr # - mongodb-csr.json # - mongodb-key.pem # - mongodb.pem - name: Ensure Lab's Git Repository Folder has required permissions file: path: "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}" state: directory recurse: yes owner: "{{ _clientvm_student_user }}" group: "{{ _clientvm_student_user }}" - name: Ensure Cluster Names are Updated in Lab's Yaml Files replace: @@ -65,20 +20,20 @@ regexp: feddemocl replace: cluster loop: - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/01-mongo-federated-secret.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/02-mongo-federated-service.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/03-mongo-federated-pvc.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/04-mongo-federated-deployment-rs.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/01-mongo-federated-secret.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/02-pacman-federated-service.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/03-pacman-federated-ingress.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/04-pacman-federated-service-account.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/05-pacman-federated-cluster-role.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/06-pacman-federated-cluster-role-binding.yaml" - "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/07-pacman-federated-deployment-rs.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/01-mongo-federated-secret.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/02-mongo-federated-service.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/03-mongo-federated-pvc.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/mongo-yaml/04-mongo-federated-deployment-rs.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/01-mongo-federated-secret.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/02-pacman-federated-service.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/03-pacman-federated-ingress.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/04-pacman-federated-service-account.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/05-pacman-federated-cluster-role.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/06-pacman-federated-cluster-role-binding.yaml" - "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}/labs/pacman-yaml/07-pacman-federated-deployment-rs.yaml" # Leave this as the last task in the playbook. - name: post_workload tasks complete debug: msg: "Post-Workload Tasks completed successfully." when: not silent|bool when: not silent|bool ansible/roles/ocp4-workload-rhte-kubefed-app-portability/tasks/remove_workload.yml
@@ -14,13 +14,6 @@ kind: Namespace state: absent - name: Ensure HAProxy Project is Removed k8s: name: "{{ _haproxy_project }}" api_version: v1 kind: Namespace state: absent - name: Ensure Downloaded Tools are Removed file: path: "{{ item }}" @@ -33,13 +26,9 @@ - name: Ensure Cloned Repository is Removed file: path: "/home/{{ ansible_user }}/{{ _lab_git_clone_dir_name }}" path: "/home/{{ _clientvm_student_user }}/{{ _lab_git_clone_dir_name }}" state: absent - name: Ensure Mongo TLS Folder is Removed file: path: "/home/{{ ansible_user }}/mongo_tls" state: absent become: true # Leave this as the last task in the playbook. - name: remove_workload tasks complete ansible/roles/ocp4-workload-rhte-kubefed-app-portability/tasks/workload.yml
@@ -5,12 +5,6 @@ debug: msg: "Setting up workload for user ocp_username = {{ ocp_username }}" #- name: Setting up custom facts # set_fact: # pacman_cluster1_route_hostname: "pacman.{{ cluster1_wildcard_domain }}" # pacman_cluster2_route_hostname: "pacman.{{ cluster2_wildcard_domain }}" # pacman_cluster3_route_hostname: "pacman.{{ cluster3_wildcard_domain }}" - name: Ensure OpenShift Objects for KubeFed are Created k8s: state: present @@ -55,64 +49,6 @@ delay: 10 until: kubefed_operator_ready_replicas.stdout == kubefed_operator_desired_replicas.stdout - name: Ensure KubeFed Resource is Created k8s: state: present merge_type: - strategic-merge - merge definition: "{{ lookup('template', item ) | from_yaml }}" loop: - ./templates/kubefed.j2 - name: Get KubeFed Controller Deployment Desired Replicas command: oc get deployment "{{ _kubefed_controller_deployment }}" -o jsonpath='{.status.replicas}' -n "{{ _kubefed_project }}" register: kubefed_controller_desired_replicas retries: 30 delay: 10 until: kubefed_controller_desired_replicas.stdout != "" - name: Wait until KubeFed Controller Deployment is Ready command: oc get deployment "{{ _kubefed_controller_deployment }}" -o jsonpath='{.status.readyReplicas}' -n "{{ _kubefed_project }}" register: kubefed_controller_ready_replicas retries: 30 delay: 10 until: kubefed_controller_ready_replicas.stdout == kubefed_controller_desired_replicas.stdout #- name: Ensure Pacman LB Route is Created # k8s: # state: present # merge_type: # - strategic-merge # - merge # definition: "{{ lookup('template', item ) | from_yaml }}" # loop: # - ./templates/haproxy_project.j2 # - ./templates/haproxy_route.j2 #- name: Get HAProxy Route # command: oc get route haproxy-lb -o jsonpath='{.status.ingress[*].host}' -n "{{ _haproxy_project }}" # register: haproxy_route_hostname # retries: 30 # delay: 10 # until: haproxy_route_hostname.stdout != "" #- name: Set Pacman LB Fact # set_fact: # pacman_lb_hostname: "{{ haproxy_route_hostname.stdout }}" #- name: Ensure OpenShift Objects for HAProxy are Created # k8s: # state: present # merge_type: # - strategic-merge # - merge # definition: "{{ lookup('template', item ) | from_yaml }}" # loop: # - ./templates/haproxy_configmap.j2 # - ./templates/haproxy_service.j2 # - ./templates/haproxy_deployment.j2 - name: Ensure kubefedctl Tool is Downloaded unarchive: src: "https://github.com/kubernetes-sigs/kubefed/releases/download/v{{ _kubefedctl_release }}/kubefedctl-{{ _kubefedctl_release }}-linux-amd64.tgz" @@ -134,11 +70,6 @@ dest: /usr/local/bin/cfssljson mode: 0755 become: true # The value of pacman_lb_hostname should be presented to the student somewhere as # it will be the route they use for connecting to pacman application #- debug: # var: pacman_lb_hostname # Leave this as the last task in the playbook. - name: workload tasks complete ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/haproxy_configmap.j2
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/haproxy_deployment.j2
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/haproxy_project.j2
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/haproxy_route.j2
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/haproxy_service.j2
File was deleted ansible/roles/ocp4-workload-rhte-kubefed-app-portability/templates/kubefed.j2
File was deleted