Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion roles/mtv_management/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,31 @@
# Overrides
# title: MTV Storage Map Override
# required: False
# description: Overrides for the storage map
# description: Overrides for the default storage map. Note: This variable is ignored if mtv_management_multiple_storage_maps_overrides is populated.

Check warning on line 142 in roles/mtv_management/defaults/main.yml

View workflow job for this annotation

GitHub Actions / ci / test / ansible-lint

yaml[line-length]

Line too long (148 > 120 characters)
mtv_management_storage_map_overrides: [
# - id: <datastore_id>
# storageClass: <name of the storage class>
# exclude: true
# include: true
]

# title: MTV Multiple Storage Maps Overrides
# required: False
# description: Dictionary of multiple storage maps. Takes precedence over
# mtv_management_storage_map_overrides. Map keys are sanitized to comply
# with Kubernetes RFC 1123 naming conventions (e.g., lowercase, hyphens only)
mtv_management_multiple_storage_maps_overrides: {}
# map_name1:
# - id: <datastore_id>
# storageClass: <name of the storage class>
# exclude: true
# include: true
# map_name2:
# - id: <datastore_id>
# storageClass: <name of the storage class>
# exclude: true
# include: true

# title: MTV Network Map Overrides
# required: False
# description: Overrides for the network map
Expand Down
42 changes: 37 additions & 5 deletions roles/mtv_management/tasks/mtv_maps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
that:
- mtv_providers is defined
- mtv_providers.vsphere is defined
- mtv_providers.vsphere | selectattr('name', 'equalto', mtv_management_source_target) | selectattr('namespace', 'equalto', mtv_management_provider_namespace) | list | length == 1 # noqa: yaml[line-length]
- >-
mtv_providers.vsphere
| selectattr('name', 'equalto', mtv_management_source_target)
| selectattr('namespace', 'equalto', mtv_management_provider_namespace)
| list | length == 1
quiet: true
fail_msg: "Source Provider with name '{{ mtv_management_source_target }}' not found in namespace '{{ mtv_management_provider_namespace }}'" # noqa: yaml[line-length]
fail_msg: >-
Source Provider with name '{{ mtv_management_source_target }}'
not found in namespace '{{ mtv_management_provider_namespace }}'
when: "'vsphere' in provider"

- name: mtv_maps | Verify Ovirt Source Provider Exists
Expand All @@ -25,7 +31,6 @@
quiet: true
fail_msg: "Source Provider with name '{{ mtv_management_source_target }}' not found in namespace '{{ mtv_management_provider_namespace }}'" # noqa: yaml[line-length]
when: "'ovirt' in provider"

- name: mtv_maps | Destination OpenShift Destination Provider Exists
ansible.builtin.assert:
that:
Expand All @@ -35,10 +40,37 @@
quiet: true
fail_msg: "Destination Provider with name '{{ mtv_management_destination_target }}' not found in namespace '{{ mtv_management_provider_namespace }}'" # noqa: yaml[line-length]

- name: mtv_maps | Configure MTV Storage Maps
ansible.builtin.include_tasks: _mtv_storage_map.yml
- name: mtv_maps | Verify mutually exclusive storage map overrides
ansible.builtin.assert:
that:
- >-
not (mtv_management_multiple_storage_maps_overrides | default({}) | length > 0
and mtv_management_storage_map_overrides | default([]) | length > 0)
quiet: true
fail_msg: >-
Cannot define both mtv_management_storage_map_overrides and
mtv_management_multiple_storage_maps_overrides simultaneously.
Please choose one.
when: mtv_management_map_storage is defined and mtv_management_map_storage | bool

- name: mtv_maps | Configure MTV Storage Maps (Multiple)
ansible.builtin.include_tasks: _mtv_storage_map.yml
loop: "{{ mtv_management_multiple_storage_maps_overrides | dict2items }}"
vars:
defined_storage_map_name: "{{ item.key }}"
mtv_management_storage_map_overrides: "{{ item.value }}"
when:
- mtv_management_map_storage is defined and mtv_management_map_storage | bool
- mtv_management_multiple_storage_maps_overrides is defined
- mtv_management_multiple_storage_maps_overrides | length > 0

- name: mtv_maps | Configure MTV Storage Maps
ansible.builtin.include_tasks: _mtv_storage_map.yml
when:
- mtv_management_map_storage is defined and mtv_management_map_storage | bool
- >-
mtv_management_multiple_storage_maps_overrides is not defined or
mtv_management_multiple_storage_maps_overrides | length == 0
- name: mtv_maps | Configure MTV Network Map
ansible.builtin.include_tasks: _mtv_network_map.yml
when: mtv_management_map_networks is defined and mtv_management_map_networks | bool
Expand Down
2 changes: 1 addition & 1 deletion roles/mtv_management/templates/storagemap.yml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: forklift.konveyor.io/v1beta1
kind: StorageMap
metadata:
name: "{{ (mtv_management_source_target + '-' + mtv_management_destination_target) | infra.openshift_virtualization_migration.rfc1123 }}"
name: "{{ defined_storage_map_name | default(mtv_management_source_target + '-' + mtv_management_destination_target) | infra.openshift_virtualization_migration.rfc1123 }}"
namespace: "{{ mtv_management_migration_namespace }}"
spec:
provider:
Expand Down
Loading