Add the ability to map volumes to a host cluster when using ibm_svc_vol_map.
ISSUE TYPE
Feature Idea
COMPONENT NAME
ibm_svc_vol_map module.
ADDITIONAL INFORMATION
This module when mapping a volume to multiple hosts, will map the volume to host #1 and consider that the volume is now mapped and ignore all subsequent hosts. While fixing this would be good, what would be better would be the ability to map to a host cluster. Use case is an automated DR test for VMware. Workaround is to use the Storwize REST API with ansible uri module.
This would be ideal:
- name: "Map my volumes to a host cluster"
ibm.spectrum_virtualize.ibm_svc_vol_map:
clustername: "my_cluster"
username: "talor"
password: "..."
volname: "{{ item }}"
hostcluster: "my-awesome-host-cluster"
state: present
loop:
- "{{ import_storwize_volumes }}"
This is what I'm doing now, and it only ever maps the volume to the first host it iterates over.
The workaround to get it mapped to remaining hosts is below (I'd loop over this playbook) per host per volume, and want to avoid having to do this. The variables "volume" and "host" are passed to this.
- debug:
msg: "Processing {{ volume }}"
- name: "Give me yo storwize api token"
uri:
url: "https://my_cluster:7443/rest/auth"
method: POST
validate_certs: yes
headers:
X-Auth-Username: "talor"
X-Auth-Password: "..."
register: storwize_token
no_log: true
- name: "Check yo host mapping"
uri:
url: "https://my_cluster:7443/rest/lsvdiskhostmap/{{ volume }}"
method: POST
headers:
Content-Type: "application/json"
X-Auth-Token: "{{ storwize_token.json.token }}"
body_format: json
validate_certs: yes
register: mapping_state
- name: "Create an array of mapped hosts"
set_fact:
mapped_hosts: "{{ mapped_hosts | default([]) + [line_item.host_name] }}"
with_items:
- "{{ mapping_state.json }}"
loop_control:
loop_var: line_item
- name: "Create a glorious host mapping"
uri:
url: "https://my_cluster:7443/rest/mkvdiskhostmap/{{ volume }}"
method: POST
headers:
Content-Type: "application/json"
X-Auth-Token: "{{ storwize_token.json.token }}"
body: '{"force": true, "host": "{{ host }}"}'
body_format: json
validate_certs: yes
when: host not in mapped_hosts
SUMMARY
Add the ability to map volumes to a host cluster when using ibm_svc_vol_map.
ISSUE TYPE
COMPONENT NAME
ibm_svc_vol_map module.
ADDITIONAL INFORMATION
This module when mapping a volume to multiple hosts, will map the volume to host #1 and consider that the volume is now mapped and ignore all subsequent hosts. While fixing this would be good, what would be better would be the ability to map to a host cluster. Use case is an automated DR test for VMware. Workaround is to use the Storwize REST API with ansible uri module.
This would be ideal:
This is what I'm doing now, and it only ever maps the volume to the first host it iterates over.
The workaround to get it mapped to remaining hosts is below (I'd loop over this playbook) per host per volume, and want to avoid having to do this. The variables "volume" and "host" are passed to this.