ansible/roles/ocp4-workload-infra-nodes/readme.adoc
@@ -1,23 +1,20 @@ = ocp4-workload-infra-nodes - Create infrastructure nodes for OCP 4 = ocp4-workload-infra-nodes - Create infra nodes for OCP 4 == Role overview * This role creates infrastructure nodes in an OpenShift 4 Cluster. It only creates a single infra machineset with 3 replicas of size m4.4xlarge. It consists of the following playbooks: ** Playbook: link:./tasks/pre_workload.yml[pre_workload.yml] - Sets up an environment for the workload deployment. * This role creates infrastructure nodes in an OpenShift 4 Cluster. It creates an infra machineset for each availability zone found and then scales the machinesets to the number of infra nodes desired. It does the same for Elasticsearch Machinesets if desired. It consists of the following playbooks: ** 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 create the infra nodes *** 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 ** 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 removes the infrastructure nodes (DANGER!!!) ** Playbook: link:./tasks/remove_workload.yml[remove_workload.yml] - Used to delete the workload *** This role removes the infrastructure nodes (DANGER!!!). It will not remove node selectors from infra components. This will have to be done manually. *** Debug task will print out: `remove_workload Tasks completed successfully.` == Review the defaults variable file @@ -30,9 +27,9 @@ === Deploy a Workload with the `ocp-workload` playbook [Mostly for testing] ---- TARGET_HOST="bastion.na311.openshift.opentlc.com" OCP_USERNAME="shacharb-redhat.com" WORKLOAD="ocp-workload-enable-service-broker" TARGET_HOST="bastion.ocp43.openshift.opentlc.com" OCP_USERNAME="opentlc-mgr" WORKLOAD="ocp4-workload-infra-nodes" GUID=1001 # a TARGET_HOST is specified in the command line, without using an inventory file @@ -49,7 +46,7 @@ === To Delete an environment ---- TARGET_HOST="bastion.na311.openshift.opentlc.com" TARGET_HOST="bastion.ocp43.openshift.opentlc.com" OCP_USERNAME="opentlc-mgr" WORKLOAD="ocp4-workload-infra-nodes" GUID=1002 @@ -63,7 +60,6 @@ -e"guid=${GUID}" \ -e"ACTION=remove" ---- == Other related information: ansible/roles/ocp4-workload-infra-nodes/tasks/main.yml
@@ -1,5 +1,4 @@ --- # Do not modify this file - name: Running Pre Workload Tasks ansible/roles/ocp4-workload-infra-nodes/tasks/post_workload.yml
@@ -1,7 +1,6 @@ --- # Implement your Post Workload deployment tasks here # Leave this as the last task in the playbook. - name: post_workload tasks complete debug: ansible/roles/ocp4-workload-infra-nodes/tasks/pre_workload.yml
@@ -1,7 +1,6 @@ --- # Implement your Pre Workload deployment tasks here # Leave this as the last task in the playbook. - name: pre_workload tasks complete debug: ansible/roles/ocp4-workload-infra-nodes/tasks/remove_workload.yml
@@ -38,6 +38,8 @@ debug: msg: "WARNING: Make sure to change the node selectors for Ingress Controllers, Image Registry and Monitoring" # Seems there is no way to >remove< things via k8s modules. Only add. So node selectors etc need to be removed manually. # - name: Move Ingress Controllers to Worker Nodes # k8s: # state: present ansible/roles/ocp4-workload-logging/defaults/main.yml
@@ -5,12 +5,22 @@ _logging_elasticsearch_replicas: 1 _logging_elasticsearch_memory_request: "8Gi" _logging_elasticsearch_storage_request: "200Gi" _logging_elasticsearch_storage_request: "50Gi" # Set to true to place pods on nodes with label # node-role.kubernetes.io/infra: "" _logging_use_infra_nodes: False # Set to true to place pods on nodes with label # node-role.kubernetes.io/elasticsearch: "" _logging_use_elasticsearch_nodes: True # If both are false the Logging Components will run on Worker nodes # Set the following to specify dedicated nodes for the logging # The nodes need to be exist (e.g. via the role ocp4-workload-infra-nodes) # # If set then the following needs to be true: # Node has a label: # node-role.kubernetes.io/{{ _logging_use_dedicated_nodes }}: "" # e.g. node-role.kubernetes.io/infra: "" # Node has taints: # - key: "{{ _logging_use_dedicated_nodes }}" # value: reserved # effect: NoSchedule # - key: "{{ _logging_use_dedicated_nodes }}" # value: reserved # effect: NoExecute # Example: # _logging_use_dedicated_nodes: "elasticsearch" _logging_use_dedicated_nodes: "" ansible/roles/ocp4-workload-logging/files/logging_curator_configmap.yaml
@@ -44,7 +44,7 @@ # unit_count: 30 # exclude: False config.yaml: | # Logging curator configuration for Red Hat GPTE Clustgers # Logging curator configuration for Red Hat GPTE Clusters # Delete all non-specifiec projects after 1 week .defaults: ansible/roles/ocp4-workload-logging/readme.adoc
@@ -1,22 +1,20 @@ = ocp4-workload-logging - Deploy logging into OCP4 = ocp4-workload-logging - Deploy cluster logging into OCP4 == Role overview * This role deploys logging into an OpenShift 4 Cluster. It depends on infrastructure nodes existing. It consists of the following playbooks: ** Playbook: link:./tasks/pre_workload.yml[pre_workload.yml] - Sets up an environment for the workload deployment. * This role deploys cluster logging into an OpenShift 4 Cluster. It depends on infrastructure nodes existing (run `ocp4-workload-infra-nodes` workload first). It consists of the following playbooks: ** 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 logging *** 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 ** 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 ** Playbook: link:./tasks/remove_workload.yml[remove_workload.yml] - Used to delete the workload *** This role removes the logging deployment and project but not the operator configs *** Debug task will print out: `remove_workload Tasks completed successfully.` @@ -30,9 +28,9 @@ === Deploy a Workload with the `ocp-workload` playbook [Mostly for testing] ---- TARGET_HOST="bastion.na311.openshift.opentlc.com" OCP_USERNAME="shacharb-redhat.com" WORKLOAD="ocp-workload-enable-service-broker" TARGET_HOST="bastion.ocp43.openshift.opentlc.com" OCP_USERNAME="opentlc-mgr" WORKLOAD="ocp4-workload-logging" GUID=1001 # a TARGET_HOST is specified in the command line, without using an inventory file @@ -49,9 +47,9 @@ === To Delete an environment ---- TARGET_HOST="bastion.na311.openshift.opentlc.com" TARGET_HOST="bastion.ocp43.openshift.opentlc.com" OCP_USERNAME="opentlc-mgr" WORKLOAD="ocp4-workload-infra-nodes" WORKLOAD="ocp4-workload-logging" GUID=1002 # a TARGET_HOST is specified in the command line, without using an inventory file ansible/roles/ocp4-workload-logging/tasks/main.yml
@@ -1,5 +1,4 @@ --- # Do not modify this file - name: Running Pre Workload Tasks ansible/roles/ocp4-workload-logging/tasks/post_workload.yml
@@ -1,7 +1,6 @@ --- # Implement your Post Workload deployment tasks here # Leave this as the last task in the playbook. - name: post_workload tasks complete debug: ansible/roles/ocp4-workload-logging/tasks/pre_workload.yml
@@ -1,7 +1,6 @@ --- # Implement your Pre Workload deployment tasks here # Leave this as the last task in the playbook. - name: pre_workload tasks complete debug: ansible/roles/ocp4-workload-logging/tasks/remove_workload.yml
@@ -1,4 +1,3 @@ # vim: set ft=ansible --- # Implement your Workload removal tasks here - name: Remove OpenShift ClusterLogging ansible/roles/ocp4-workload-logging/tasks/workload.yml
@@ -10,13 +10,22 @@ - name: Install Elasticsearch Operator if not installed when: r_eo_deployment_exists.resources | length | int == 0 block: - name: Get current stable version of Elasticsearch shell: "oc get packagemanifest elasticsearch-operator -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" register: r_eo_version - name: Get current stable channel for Elasticsearch k8s_facts: api_version: packages.operators.coreos.com/v1 kind: PackageManifest name: elasticsearch-operator namespace: openshift-marketplace register: r_eo_channel - name: Set Elasticsearch channel set_fact: logging_elasticsearch_channel: "{{ r_eo_channel.resources[0].status.defaultChannel }}" # shell: "oc get packagemanifest elasticsearch-operator -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" # register: r_eo_version - name: Print Elasticsearch version to be installed - name: Print Elasticsearch channel to be installed debug: msg: "Elasticsearch version to be installed: {{ r_eo_version.stdout }}" msg: "Elasticsearch channel to be installed: {{ logging_elasticsearch_channel }}" - name: Install Elasticsearch operator prerequisites k8s: @@ -49,13 +58,24 @@ - r_eo_deployment.resources[0].status.availableReplicas is defined - r_eo_deployment.resources[0].status.availableReplicas | int == r_eo_deployment.resources[0].spec.replicas | int - name: Get current stable version of Cluster Logging shell: "oc get packagemanifest cluster-logging -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" register: r_logging_version - name: Get current stable channel for Cluster Logging k8s_facts: api_version: packages.operators.coreos.com/v1 kind: PackageManifest name: cluster-logging namespace: openshift-marketplace register: r_logging_channel - name: Set Cluster Logging channel set_fact: logging_channel: "{{ r_logging_channel.resources[0].status.defaultChannel }}" - name: Print Cluster Logging version to be installed # - name: Get current stable version of Cluster Logging # shell: "oc get packagemanifest cluster-logging -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'" # register: r_logging_version - name: Print Cluster Logging channel to be installed debug: msg: "Cluster Logging version to be installed: {{ r_logging_version.stdout }}" msg: "Cluster Logging channel to be installed: {{ logging_channel }}" - name: Install OpenShift Logging Operator Prerequisites k8s: ansible/roles/ocp4-workload-logging/templates/cluster_logging.j2
@@ -15,22 +15,13 @@ redundancyPolicy: "ZeroRedundancy" {% endif %} nodeSelector: {% if _logging_use_infra_nodes|bool %} node-role.kubernetes.io/infra: "" {% if _logging_use_dedicated_nodes | d("") | length > 0 %} "node-role.kubernetes.io/{{ _logging_use_dedicated_nodes }}": "" tolerations: - key: infra - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoSchedule - key: infra value: reserved effect: NoExecute {% elif _logging_use_elasticsearch_nodes | bool %} node-role.kubernetes.io/elasticsearch: "" tolerations: - key: elasticsearch value: reserved effect: NoSchedule - key: elasticsearch - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoExecute {% else %} @@ -47,22 +38,13 @@ kibana: replicas: 1 nodeSelector: {% if _logging_use_infra_nodes|bool %} node-role.kubernetes.io/infra: "" {% if _logging_use_dedicated_nodes | d("") | length > 0 %} "node-role.kubernetes.io/{{ _logging_use_dedicated_nodes }}": "" tolerations: - key: infra - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoSchedule - key: infra value: reserved effect: NoExecute {% elif _logging_use_elasticsearch_nodes | bool %} node-role.kubernetes.io/elasticsearch: "" tolerations: - key: elasticsearch value: reserved effect: NoSchedule - key: elasticsearch - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoExecute {% else %} @@ -73,22 +55,13 @@ curator: schedule: "30 3 * * *" nodeSelector: {% if _logging_use_infra_nodes|bool %} node-role.kubernetes.io/infra: "" {% if _logging_use_dedicated_nodes | d("") | length > 0 %} "node-role.kubernetes.io/{{ _logging_use_dedicated_nodes }}": "" tolerations: - key: infra - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoSchedule - key: infra value: reserved effect: NoExecute {% elif _logging_use_elasticsearch_nodes | bool %} node-role.kubernetes.io/elasticsearch: "" tolerations: - key: elasticsearch value: reserved effect: NoSchedule - key: elasticsearch - key: "{{ _logging_use_dedicated_nodes }}" value: reserved effect: NoExecute {% else %} ansible/roles/ocp4-workload-logging/templates/eo_subscription.j2
@@ -1,10 +1,10 @@ apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: "elasticsearch-operator-{{ r_eo_version.stdout }}" name: "elasticsearch-operator-{{ logging_elasticsearch_channel }}" namespace: "openshift-operators-redhat" spec: channel: "{{ r_eo_version.stdout }}" channel: "{{ logging_elasticsearch_channel }}" installPlanApproval: "Automatic" source: "redhat-operators" sourceNamespace: "openshift-marketplace" ansible/roles/ocp4-workload-logging/templates/logging_subscription.j2
@@ -4,7 +4,7 @@ name: cluster-logging namespace: openshift-logging spec: channel: "{{ r_logging_version.stdout }}" channel: "{{ logging_channel }}" installPlanApproval: Automatic name: cluster-logging source: redhat-operators