Skip to content

Commit

Permalink
[minor] Support MVI integration with Object Storage in oneclick_add_v…
Browse files Browse the repository at this point in the history
…isualinspection (#1125)

Co-authored-by: David Parker <[email protected]>
  • Loading branch information
andrercm and durera committed Dec 18, 2023
1 parent 2e37184 commit 49b2546
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/playbooks/oneclick-visualinspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ All timings are estimates, see the individual pages for each of these playbooks
## Optional environment variables
- `MAS_APP_SETTINGS_VISUALINSPECTION_STORAGE_CLASS` Defines a custom file storage class for Visual Inspection application. If none provided, then a default storage class will be auto defined accordingly to your cluster's availability i.e `ibmc-file-gold` for IBM Cloud or `azurefiles-premium` for Azure clusters.
- `MAS_APP_SETTINGS_VISUALINSPECTION_STORAGE_SIZE` Defines persistent storage size for Visual Inspection application. If not provided, default is `100Gi`.
- `MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_ENABLED` If set to `true`, enables [Object Storage integration with Visual Inspection](https://www.ibm.com/docs/en/mas-cd/maximo-vi/continuous-delivery?topic=managing-object-storage).
- `MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_WORKSPACE` Defines the Object Storage bucket name to be used for Visual Inspection integration.
- `CONFIGURE_COS` If set to `true`, an Object Storage instance will be configured as MAS system scope configuration which will be used for Visual Inspection integration. See [cos](https://ibm-mas.github.io/ansible-devops/roles/cos/) role documentation for detailed information.
- `CONFIGURE_COS_BUCKET` If set to `true`, an Object Storage bucket will be configured to be used for Visual Inspection application. See [cos_bucket](https://ibm-mas.github.io/ansible-devops/roles/cos_bucket/) role documentation for detailed information.


## Usage
```bash
Expand Down
43 changes: 39 additions & 4 deletions ibm/mas_devops/playbooks/oneclick_add_visualinspection.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# Add (MVI) Maximo Visual Inspection 8.8.x application to an existing MAS Core installation
# Add (MVI) Maximo Visual Inspection application to an existing MAS Core installation
#
# Dependencies:
# - ansible-playbook ibm.mas_devops.oneclick_core
Expand All @@ -9,13 +9,20 @@

vars:
# Application Installation
# mas_app_id can be set to "health" to install manage in the "Health standalone" mode from this same playbook.
mas_app_id: visualinspection
mas_app_channel: "{{ lookup('env', 'MAS_APP_CHANNEL') | default('8.9.x', true) }}"

# Application Configuration
mas_workspace_id: "{{ lookup('env', 'MAS_WORKSPACE_ID') | default('masdev', true) }}"

# Additional Condfiguration - Object Storage
configure_cos: "{{ lookup('env', 'CONFIGURE_COS') | default('false', true) | bool }}"
configure_cos_bucket: "{{ lookup('env', 'CONFIGURE_COS_BUCKET') | default('false', true) | bool }}"
cos_type: "{{ lookup('env', 'COS_TYPE') }}"
mas_app_settings_visualinspection_object_storage_enabled: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_ENABLED') | default('false', true) | bool }}"
mas_app_settings_visualinspection_object_storage_bucket_default: 'mvi-bucket-{{ mas_instance_id }}-{{ mas_workspace_id }}'
mas_app_settings_visualinspection_object_storage_workspace: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_WORKSPACE') | default(mas_app_settings_visualinspection_object_storage_bucket_default, true) }}"

pre_tasks:
# For the full set of supported environment variables refer to the playbook documentation
- name: Check for required environment variables
Expand All @@ -25,8 +32,36 @@
- lookup('env', 'MAS_CONFIG_DIR') != ""
- lookup('env', 'IBM_ENTITLEMENT_KEY') != ""
fail_msg: "One or more required environment variables are not defined"

- include_role:
# Configure Object Storage (15 min)
# With this we are allowing options for users to also provision Object Storage instance if they don't have one setup yet
# While using cos role, users will be able to configure either OCS/ODF or IBM Cloud Object Storage instances to be used
# This will also generate the ObjectStorageCfg file that will be used to configure the target Object Storage instance
# into the target MAS instance.
name: ibm.mas_devops.cos
when:
- mas_app_settings_visualinspection_object_storage_enabled
- configure_cos
- cos_type in ['ibm','ocs']
- include_role:
# Configure COS bucket in IBM Cloud Object Storage or AWS (10 min)
# While using the cos_bucket role, users will be able to create a bucket within the IBM cloud object storage instance
# or in AWS users can allocate an S3 bucket (no need of a instance created, s3 buckets are directly created in the AWS account)
name: ibm.mas_devops.cos_bucket
when:
- mas_app_settings_visualinspection_object_storage_enabled
- mas_app_settings_visualinspection_object_storage_workspace
- configure_cos_bucket
- cos_type in ['ibm','aws']
vars:
ibmcos_bucket_name: "{{ mas_app_settings_visualinspection_object_storage_workspace }}"
aws_bucket_name: "{{ mas_app_settings_visualinspection_object_storage_workspace }}"
roles:
# Install Nvidia Operator (~15 Minutes)
- ibm.mas_devops.nvidia_gpu
- ibm.mas_devops.suite_app_install
# Apply MAS configurations related to Object Storage (~5 Minutes)
- ibm.mas_devops.suite_config
# Deploy Visual Inspection (~15 Minutes)
- name: ibm.mas_devops.suite_app_install
# Activate Visual Inspection in workspace (~15 Minutes)
- ibm.mas_devops.suite_app_config
3 changes: 3 additions & 0 deletions ibm/mas_devops/roles/suite_app_install/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ mas_app_bindings_jdbc: "{{ lookup('env', 'MAS_APP_BINDINGS_JDBC') | default('sys
# Additional Visual Inspection Settings
mas_app_settings_visualinspection_storage_class: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_STORAGE_CLASS') }}"
mas_app_settings_visualinspection_storage_size: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_STORAGE_SIZE') | default('100Gi', true) }}"
mas_app_settings_visualinspection_object_storage_enabled: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_ENABLED') | default('false', true) | bool }}"
mas_app_settings_visualinspection_object_storage_bucket_name_default: "mvi-bucket-{{ mas_instance_id }}-{{ mas_workspace_id }}"
mas_app_settings_visualinspection_object_storage_workspace: "{{ lookup('env', 'MAS_APP_SETTINGS_VISUALINSPECTION_OBJECT_STORAGE_WORKSPACE') | default(mas_app_settings_visualinspection_object_storage_bucket_name_default, true) | bool }}"

# Additional IoT Settings
mas_app_settings_iot_deployment_size: "{{ lookup('env', 'MAS_APP_SETTINGS_IOT_DEPLOYMENT_SIZE') | default('small', true) }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

# Provide intelligent storage class selection to minimize required user knowledge

# 1. Lookup storage class availabiity
Expand All @@ -17,7 +16,6 @@
debug:
msg: "{{ lookup_storageclasses | ibm.mas_devops.getResourceNames }}"


# 2. Set Storage (Required)
# -----------------------------------------------------------------------------
- name: Default Storage if not set by user
Expand All @@ -30,6 +28,13 @@
that: mas_app_settings_visualinspection_storage_class is defined and mas_app_settings_visualinspection_storage_class != ""
fail_msg: "mas_app_settings_visualinspection_storage_class must be defined"

- name: Enable Object Storage integration
set_fact:
mas_app_spec: "{{ lookup('ansible.builtin.template', 'vars/customspecs/{{ mas_app_id }}.yml.j2') | from_yaml }}"
when:
- mas_app_spec is not defined
- mas_app_settings_visualinspection_object_storage_enabled

# 3. Debug storage class configuration
# -----------------------------------------------------------------------------
- name: "Debug visualinspection storage class configuration"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

settings:
storage:
size: "{{ mas_app_settings_visualinspection_storage_size }}"
storageClassName: "{{ mas_app_settings_visualinspection_storage_class }}"
{% if mas_app_settings_visualinspection_object_storage_enabled and mas_app_settings_visualinspection_object_storage_workspace %}
objectStorageEnabled: {{ mas_app_settings_visualinspection_object_storage_enabled }}
objectStorageBucketNames:
"{{ mas_workspace_id }}": "{{ mas_app_settings_visualinspection_object_storage_workspace }}"
{% endif %}

0 comments on commit 49b2546

Please sign in to comment.