Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovirt_remove_stale_lun: Allow user to remove multiple LUNs #357

Merged
merged 1 commit into from
Oct 13, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- ovirt_remove_stale_lun - Allow user to remove multiple LUNs (https://github.com/oVirt/ovirt-ansible-collection/pull/357).
4 changes: 2 additions & 2 deletions roles/remove_stale_lun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Role Variables
| Name | Default value | |
|-------------------------|-----------------------|-----------------------------------------------------|
| data_center | Default | Name of the data center from which hosts stale LUN should be removed. |
| lun_wwid | UNDEF | WWID of the stale LUN which should be removed from the hosts. |
| lun_wwid | UNDEF | WWID of the stale LUN(s) which should be removed from the hosts. Separate multiple LUNs with spaces. |


Example Playbook
Expand All @@ -37,7 +37,7 @@ Example Playbook
engine_user: admin@internal

data_center: default
lun_wwid: 36001405a77a1ee25cbf4439b7ddd2062
lun_wwid: 36001405a77a1ee25cbf4439b7ddd2062 36001405ddefe8392bb8443e89bde4b40

roles:
- remove_stale_lun
Expand Down
2 changes: 1 addition & 1 deletion roles/remove_stale_lun/examples/remove_stale_lun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
engine_user: admin@internal

data_center: default
lun_wwid: 36001405a77a1ee25cbf4439b7ddd2062
lun_wwid: 36001405a77a1ee25cbf4439b7ddd2062 36001405ddefe8392bb8443e89bde4b40

roles:
- remove_stale_lun
Expand Down
6 changes: 3 additions & 3 deletions roles/remove_stale_lun/tasks/remove_mpath_device.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: Get underlying disks (paths) for a multipath device and turn them into a list.
ansible.builtin.shell: dmsetup deps -o devname "{{ lun_wwid }}" | cut -f 2 |cut -c 3- |tr -d "()"
- name: Get underlying disks (paths) for a multipath device(s) and turn them into a list.
ansible.builtin.shell: 'for dev in {{ lun_wwid }}; do dmsetup deps -o devname $dev | cut -f 2 |cut -c 3- |tr -d "()"|tr "\r\n" " "; done'
register: disks
delegate_to: "{{ host_item.address }}"
connection: ssh
Expand All @@ -10,7 +10,7 @@
loop_var: host_item

- name: Remove from multipath device.
ansible.builtin.shell: multipath -f "{{ lun_wwid }}"
ansible.builtin.shell: "for dev in {{ lun_wwid }}; do multipath -f $dev; done"
delegate_to: "{{ host_item.address }}"
connection: ssh
check_mode: "no"
Expand Down