Creating a Runbook for Patching

Create a runbook to apply patches to the Apache Tomcat product in Fleet Application Management.

  1. Create a runbook for patching.
    Provide basic information such as the runbook name (Apache Tomcat Patching), select the Apache Tomcat custom product, lifecycle operation (Patch), and the required operating system (Linux.)

    Add parallel or rolling resource containers depending on how you want to want the task execution for patching to be run across resources and configure them.

  2. Add tasks for pre-health check or validation, stopping the service, backing up the service, applying the patch, starting the service, and post-health check or validation to the runbook created in step 1.
    Each of the task requires you to upload an associated script that has the required logic to perform the specific task and lead to an outcome. See Sample YAML for Patching or Sample JSON for Patching. The response from one task can be fed as input to another task in the form of variables through output variable mapping.

    When adding the patch application task, select the This task needs patches to execute checkbox to indicate that it's a patch application step and needs patch information to be provided to it when it's run on the resource.

    For example, a runbook patch script can appear as follows:

    • Patching and rollback:

      Object Storage > Compartment: mycompartment > my_bucket > apache_tomcat_scripts.zip
    • Pre-health check task command with value:

      unzip -q -o apache_tomcat_scripts.zip; chmod +x apache_tomcat_precheck.sh; sh apache_tomcat_precheck.sh
    • Apply patch task command with value:

      unzip -q -o apache_tomcat_scripts.zip; chmod +x apache_tomcat_patching.sh; sh apache_tomcat_patching.sh
    • Post-health check task command with value:

      unzip -q -o apache_tomcat_scripts.zip; chmod +x apache_tomcat_postcheck.sh; sh apache_tomcat_postcheck.sh
    • Rollback task with command, if required:

      unzip -q -o apache_tomcat_scripts.zip; chmod +x apache_tomcat_rollback.sh; sh apache_tomcat_rollback.sh
You now have the runbook with tasks that applies patches to the Apache Tomcat product.

Sample JSON for Patching

Here's a sample JSON for applying software patches to Apache Tomcat.

{
  "compartmentId": "<your_root_compartment_ocid>",
  "displayName": "Apache Tomcat Patching",
  "description": Runbook to patch Apache Tomcat Product Homes on an instance,
  "operation": "PATCH",
  "runbookRelevance": "PRODUCT",
  "platform": "Apache Tomcat",
  "isDefault": false,
  "osType": "LINUX",
  "estimatedTime": "1",
  "associations": {
    "groups": [
      {
        "name": "Parallel_resource_container",
        "type": "PARALLEL_RESOURCE_GROUP",
        "properties": {
          "actionOnFailure": "ABORT",
          "condition": null
        }
      }
    ],
    "tasks": [
      {
        "stepName": "Apache_Tomcat_patching_task",
        "associationType": "TASK",
        "taskRecordDetails": {
          "scope": "LOCAL",
          "executionDetails": {
            "executionType": "SCRIPT",
            "variables": null,
            "content": {
              "sourceType": "OBJECT_STORAGE_BUCKET",
              "namespaceName": "mytenancynamespace",
              "bucketName": "demo_bucket",
              "objectName": "apache_tomcat_scripts.zip",
              "checksum": "PTCQgxnWZ7Oh/VVTbIrGdudMA=="
            },
            "command": "unzip -q -o apache_tomcat_scripts.zip; chmod +x apache_tomcat_patching.sh ; sh apache_tomcat_patching.sh",
            "credentials": []
          },
          "description": "Apache_Tomcat_patching_task",
          "platform": "Apache Tomcat",
          "isCopyToLibraryEnabled": false,
          "osType": "LINUX",
          "properties": {
            "numRetries": 0,
            "timeoutInSeconds": 3000
          },
          "isDiscoveryOutputTask": false,
          "isApplySubjectTask": true,
          "name": "Apache_Tomcat_patching_task"
        },
        "stepProperties": {
          "actionOnFailure": "ABORT",
          "condition": null
        },
        "outputVariableMappings": []
      }
    ],
    "executionWorkflowDetails": {
      "workflow": [
        {
          "groupName": "Parallel_resource_container",
          "type": "PARALLEL_RESOURCE_GROUP",
          "steps": [
            {
              "type": "TASK",
              "stepName": "Apache_Tomcat_patching_task"
            }
          ]
        }
      ]
    }
  }
}

Sample YAML for Patching

Here's a sample YAML for applying patches to Apache Tomcat.

compartmentId: <your_root_compartment_ocid>
displayName: Apache Tomcat Patching
description: Runbook to patch Apache Tomcat Product Homes on an instance
operation: PATCH
runbookRelevance: PRODUCT
platform: Apache Tomcat
isDefault: false
osType: LINUX
estimatedTime: "1"
associations:
  groups:
    - name: Parallel_resource_container
      type: PARALLEL_RESOURCE_GROUP
      properties:
        actionOnFailure: ABORT
        condition: null
  tasks:
    - stepName: Apache_Tomcat_patching_task
      associationType: TASK
      taskRecordDetails:
        scope: LOCAL
        executionDetails:
          executionType: SCRIPT
          variables: null
          content:
            sourceType: OBJECT_STORAGE_BUCKET
            namespaceName: mytenancynamespace
            bucketName: demo_bucket
            objectName: apache_tomcat_scripts.zip
            checksum: PTCQgxnWZ7Oh/VVTbIrGdudMA==
          command: unzip -q -o apache_tomcat_scripts.zip; chmod +x
            apache_tomcat_patching.sh ; sh apache_tomcat_patching.sh
          credentials: []
        description: Apache_Tomcat_patching_task
        platform: Apache Tomcat
        isCopyToLibraryEnabled: false
        osType: LINUX
        properties:
          numRetries: 0
          timeoutInSeconds: 3000
        isDiscoveryOutputTask: false
        isApplySubjectTask: true
        name: Apache_Tomcat_patching_task
      stepProperties:
        actionOnFailure: ABORT
        condition: null
      outputVariableMappings: []
  executionWorkflowDetails:
    workflow:
      - groupName: Parallel_resource_container
        type: PARALLEL_RESOURCE_GROUP
        steps:
          - type: TASK
            stepName: Apache_Tomcat_patching_task