MAS DevOps Ansible Collection Ansible CLI
Home Ansible Automation Platform OCP Install Cloud Pak For Data Install Core Add AIBroker Add IoT Add Manage Add Monitor Add Optimizer Add Predict Add Visual Inspection Update Upgrade Uninstall Core Backup & Restore ocp_cluster_monitoring ocp_config ocp_deprovision ocp_efs ocp_github_oauth ocp_login ocp_node_config ocp_provision ocp_roks_upgrade_registry_storage ocp_upgrade ocp_verify appconnect aws_bucket_access_point aws_documentdb_user aws_policy aws_route53 aws_user_creation aws_vpc cert_manager cis common-services configure_manage_eventstreams cos cos_bucket cp4d_admin_pwd_update cp4d cp4d_service db2 dro eck grafana ibm_catalogs kafka nvidia_gpu mongodb ocs sls turbonomic uds mirror_case_prepare mirror_extras_prepare mirror_images mirror_ocp ocp_idms ocp_simulate_disconnected_network registry suite_app_config suite_app_install suite_app_uninstall suite_app_upgrade suite_app_rollback suite_app_backup_restore suite_certs suite_config suite_db2_setup_for_manage suite_dns suite_install suite_manage_attachments_config suite_manage_birt_report_config suite_manage_bim_config suite_manage_customer_files_config suite_manage_imagestitching_config suite_manage_import_certs_config suite_manage_load_dbc_scripts suite_manage_logging_config suite_manage_pvc_config suite_uninstall suite_upgrade suite_rollback suite_verify suite_backup_restore ansible_version_check entitlement_key_rotation gencfg_jdbc gencfg_watsonstudio gencfg_workspace gencfg_mongo

Backup and Restore¤

Overview¤

MAS Devops Collection includes playbooks for backing up and restoring of the following MAS components and their dependencies:

Creation of both full and incremental backups are supported. The backup and restore Ansible roles can also be used individually, allowing you to build your own customized backup and restore playbook covering exactly what you need. For example, you can only backup/restore Manage attachments.

For more information about backup and restore for Maximo Application Suite, please refer to Backing up and restoring Maximo Application Suite in the product documentation.

Configuration - Storage¤

You can save the backup files to a folder on your local file system by setting the following environment variables:

Envrionment variable Required (Default Value) Description
MASBR_STORAGE_LOCAL_FOLDER Yes The local path to save the backup files
MASBR_LOCAL_TEMP_FOLDER No (/tmp/masbr) Local folder for saving the temporary backup/restore data, the data in this folder will be deleted after the backup/restore job completed.

Configuration - Backup¤

Envrionment variable Required (Default Value) Description
MASBR_ACTION Yes Whether to run the playbook to perform a backup or a restore
MASBR_BACKUP_TYPE No (full) Set full or incr to indicate the playbook to create a full backup or incremental backup.
MASBR_BACKUP_FROM_VERSION No Set the full backup version to use in the incremental backup, this will be in the format of a YYYMMDDHHMMSS timestamp (e.g. 20240621021316).

The playbooks are switched to backup mode by setting MASBR_ACTION to backup.

Full Backups¤

If you set environment variable MASBR_BACKUP_TYPE=full or do not specify a value for this variable, the playbook will take a full backup.

Incremental Backups¤

You can set environment variable MASBR_BACKUP_TYPE=incr to indicate the playbook to take an incremental backup.

Important

Only supports creating incremental backup for MonogDB, Db2 and persistent volume data. The playbook will always create a full backup for other type of data regardless of whether this variable be set to incr.

The environment variable MASBR_BACKUP_FROM_VERSION is only valid if MASBR_BACKUP_TYPE=incr. It indicates which backup version that the incremental backup to based on. If you do not set a value for this variable, the playbook will try to find the latest Completed Full backup from the specified storage location, and then take an incremental backup based on it.

Important

The backup files you specified by MASBR_BACKUP_FROM_VERSION must be a Full backup. And the component name and data types in the specified Full backup file must be same as the current incremental backup job.

Configuration - Restore¤

Envrionment variable Required (Default Value) Description
MASBR_ACTION Yes Whether to run the playbook to perform a backup or a restore
MASBR_RESTORE_FROM_VERSION Yes Set the backup version to use in the restore, this will be in the format of a YYYMMDDHHMMSS timestamp (e.g. 20240621021316)

The playbooks are switched to restore mode by setting MASBR_ACTION to restore. You must specify the MASBR_RESTORE_FROM_VERSION environment variable to indicate which version of the backup files to use.

In the case of restoring from an incremental backup, the corresponding full backup will be restored first before continuing to restore the incremental backup.

Backup/Restore for MongoDB¤

This playbook ibm.mas_devops.br_mongodb will invoke the role mongodb to backup/restore the MongoDB databases.

This playbook supports backing up and restoring databases for an in-cluster MongoDB CE instance. If you are using other MongoDB venders, such as IBM Cloud Databases for MongoDB, Amazon DocumentDB or MongoDB Altas Database, please refer to the corresponding vender's documentation for more information about their provided backup/restore service.

Environment Variables¤

Examples¤

# Full backup all MongoDB data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_mongodb

# Incremental backup all MongoDB data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_mongodb

# Restore all MongoDB data for the dev1 instance
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_mongodb

# Backup just the IoT MongoDB data for the dev2 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev2
export MAS_APP_ID=iot
ansible-playbook ibm.mas_devops.br_mongodb

Backup/Restore for Db2¤

This playbook ibm.mas_devops.br_db2 will invoke the role db2 to backup/restore Db2 instance.

Environment Variables¤

Examples¤

# Full backup for the db2w-shared Db2 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_db2

# Incremental backup for the db2w-shared Db2 instance
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_db2

# Restore for the db2w-shared Db2 instance
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_db2

Backup/Restore for MAS Core¤

This playbook ibm.mas_devops.br_core will backup the following components that MAS Core depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core
core suite_backup_restore MAS Core namespace resources

Environment Variables¤

Examples¤

# Full backup all core data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_core

# Incremental backup all core data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_core

# Restore all core data for the dev1 instance
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
ansible-playbook ibm.mas_devops.br_core

Backup/Restore for Manage¤

This playbook ibm.mas_devops.br_manage will backup the following components that Manage depends on in order:

Component Role Data included
mongodb mongodb MongoDB databases used by MAS Core
db2 db2 Db2 instance used by Manage
core suite_backup_restore MAS Core namespace resources
manage suite_app_backup_restore Manage namespace resources
Persistent volume data, such as attachments

Environment Variables¤

Examples¤

# Full backup all manage data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage # set this to execute db2 backup role
ansible-playbook ibm.mas_devops.br_manage

# Incremental backup all manage data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage # set this to execute db2 backup role
ansible-playbook ibm.mas_devops.br_manage

# Restore all manage data for the dev1 instance and ws1 workspace
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage # set this to execute db2 backup role
ansible-playbook ibm.mas_devops.br_manage

Backup/Restore for IoT¤

This playbook ibm.mas_devops.br_iot will backup the following components that IoT depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core and IoT
db2 db2 Db2 instance used by IoT
core suite_backup_restore MAS Core namespace resources
iot suite_app_backup_restore IoT namespace resources

Environment Variables¤

Examples¤

# Full backup all iot data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_iot

# Incremental backup all iot data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_iot

# Restore all iot data for the dev1 instance
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_iot

Backup/Restore for Monitor¤

This playbook ibm.mas_devops.br_monitor will backup the following components that Monitor depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core, IoT and Monitor
db2 db2 Db2 instance used by IoT and Monitor
core suite_backup_restore MAS Core namespace resources
iot suite_app_backup_restore IoT namespace resources
monitor suite_app_backup_restore Monitor namespace resources

Environment Variables¤

Examples¤

# Full backup all monitor data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_monitor

# Incremental backup all monitor data for the dev1 instance
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_monitor

# Restore all monitor data for the dev1 instance
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=db2w-shared
ansible-playbook ibm.mas_devops.br_monitor

Backup/Restore for Health¤

This playbook ibm.mas_devops.br_health will backup the following components that Health depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core
db2 db2 Db2 instance used by Manage and Health
core suite_backup_restore MAS Core namespace resources
manage suite_app_backup_restore Manage namespace resources
Persistent volume data, such as attachments
health suite_backup_restore Health namespace resources
Watson Studio project assets

Environment Variables¤

Examples¤

# Full backup all health data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_health

# Incremental backup all health data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_health

# Restore all health data for the dev1 instance and ws1 workspace
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_health

Backup/Restore for Optimizer¤

This playbook ibm.mas_devops.br_optimizer will backup the following components that Optimizer depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core and Optimizer
db2 db2 Db2 instance used by Manage
core suite_backup_restore MAS Core namespace resources
manage suite_app_backup_restore Manage namespace resources
Persistent volume data, such as attachments
optimizer suite_backup_restore Optimizer namespace resources

Environment Variables¤

Examples¤

# Full backup all optimizer data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_optimizer

# Incremental backup all optimizer data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_optimizer

# Restore all optimizer data for the dev1 instance and ws1 workspace
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
export DB2_INSTANCE_NAME=mas-dev1-ws1-manage
ansible-playbook ibm.mas_devops.br_optimizer

Backup/Restore for Visual Inspection¤

This playbook ibm.mas_devops.br_visualinspection will backup the following components that Visual Inspection depends on in order:

Component Ansible Role Data included
mongodb mongodb MongoDB databases used by MAS Core and Visual Inspection
core suite_backup_restore MAS Core namespace resources
visualinspection suite_app_backup_restore Visual Inspection namespace resources
Persistent volume data, such as images and models

Environment Variables¤

Examples¤

# Full backup all visual inspection data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
ansible-playbook ibm.mas_devops.br_visualinspection

# Incremental backup all visual inspection data for the dev1 instance and ws1 workspace
export MASBR_ACTION=backup
export MASBR_BACKUP_TYPE=incr
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
ansible-playbook ibm.mas_devops.br_visualinspection

# Restore all visual inspection data for the dev1 instance and ws1 workspace
export MASBR_ACTION=restore
export MASBR_STORAGE_LOCAL_FOLDER=/tmp/backup
export MASBR_RESTORE_FROM_VERSION=20240630132439
export MAS_INSTANCE_ID=dev
export MAS_WORKSPACE_ID=ws1
ansible-playbook ibm.mas_devops.br_visualinspection

Reference¤

Directory Structure¤

No matter what kind of storage systems you choose, the folder structure created in the storage system is same.

Below is the sample folder structure for saving backup jobs:

<root_folder>/backups/mongodb-main-full-20240621122530
├── backup.yml
├── database
│   ├── mongodb-main-full-20240621122530.tar.gz
│   └── query.json
└── log
    ├── mongodb-main-full-20240621122530-backup-log.tar.gz
    └── mongodb-main-full-20240621122530-ansible-log.tar.gz

<root_folder>/backups/core-main-full-20240621122530
├── backup.yml
├── log
│   ├── core-main-full-20240621122530-ansible-log.tar.gz
│   └── core-main-full-20240621122530-namespace-log.tar.gz
└── namespace
    └── core-main-full-20240621122530-namespace.tar.gz

In addition to the backup jobs, we also save restore jobs in the specified storage location. For example:

<root_folder>/restores/mongodb-main-incr-20240622040201-20240622075501
├── log
│   ├── mongodb-main-incr-20240622040201-20240622075501-ansible-log.tar.gz
│   └── mongodb-main-incr-20240622040201-20240622075501-restore-log.tar.gz
└── restore.yml

<root_folder>/restores/core-main-incr-20240622040201-20240622075501
├── log
│   ├── core-main-incr-20240622040201-20240622075501-ansible-log.tar.gz
│   └── core-main-incr-20240622040201-20240622075501-namespace-log.tar.gz
└── restore.yml

The restore playbooks will create a seperated restore job folder under the restores folder for each component. The restore job folder is named by following this format: {BACKUP JOB NAME}-{RESTORE VERSION}.

Data Model¤

backup.yml¤

kind: Backup
name: "core-main-incr-20240622040201"
version: "20240622040201"
type: "incr"
from: "core-main-full-20240621122530"
source:
  domain: "source-cluster.mydomain.com"
  suite: "8.11.11"
  instance: "main"
  workspace: ""
component:
  name: "core"
  instance: "main"
  namespace: "mas-main-core"
data:
  - seq: "1"
    type: "namespace"
    phase: "Completed"
status:
  phase: "Completed"
  startTimestamp: "2024-06-22T04:05:22"
  completionTimestamp: "2024-06-22T04:06:04"
  sentNotifications:
    - type: "Slack"
      channel: "#ansible-slack-dev"
      timestamp: "2024-06-22T04:05:34"
      phase: "InProgress"
    - type: "Slack"
      channel: "#ansible-slack-dev"
      timestamp: "2024-06-22T04:06:10"
      phase: "Completed"

restore.yml¤

kind: Restore
name: "core-main-incr-20240622040201-20240622075501"
version: "20240622075501"
from: "core-main-incr-20240622040201"
target:
  domain: "target-cluster.mydomain.com"
component:
  name: "core"
  instance: "main"
  namespace: "mas-main-core"
data:
  - seq: 1
    type: "namespace"
    phase: "Completed"
status:
  phase: "Completed"
  startTimestamp: "2024-06-22T08:04:19"
  completionTimestamp: "2024-06-22T08:04:33"