You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

  1. ---
  2. - name: "Install lvm utils (RedHat)"
  3. become: true
  4. yum:
  5. name: "lvm2"
  6. state: "present"
  7. when: "ansible_os_family == 'RedHat'"
  8. - name: "Install lvm utils (Debian)"
  9. become: true
  10. apt:
  11. name: "lvm2"
  12. state: "present"
  13. when: "ansible_os_family == 'Debian'"
  14. - name: "Get volume group information."
  15. environment:
  16. PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
  17. become: true
  18. shell: "pvs {{ disk_volume_device_1 }} --option vg_name | tail -n+2"
  19. register: "volume_groups"
  20. ignore_errors: true
  21. changed_when: false
  22. - name: "Remove volume groups."
  23. environment:
  24. PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
  25. become: true
  26. command: "vgremove {{ volume_group }} --yes"
  27. with_items: "{{ volume_groups.stdout_lines }}"
  28. loop_control: { loop_var: "volume_group" }
  29. - name: "Remove physical volume from cluster disks."
  30. environment:
  31. PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
  32. become: true
  33. command: "pvremove {{ disk_volume_device_1 }} --yes"
  34. ignore_errors: true
  35. - name: "Remove lvm utils (RedHat)"
  36. become: true
  37. yum:
  38. name: "lvm2"
  39. state: "absent"
  40. when: "ansible_os_family == 'RedHat' and heketi_remove_lvm"
  41. - name: "Remove lvm utils (Debian)"
  42. become: true
  43. apt:
  44. name: "lvm2"
  45. state: "absent"
  46. when: "ansible_os_family == 'Debian' and heketi_remove_lvm"