main.yml 578 B

12345678910111213141516171819202122
  1. - name: Check if volume is running
  2. command:
  3. argv:
  4. - gluster
  5. - volume
  6. - status
  7. - "{{ item }}"
  8. register: gluster_vol_stopped
  9. changed_when: "not ('is not started' in gluster_vol_stopped.stderr)"
  10. failed_when: false
  11. run_once: true
  12. loop: "{{ gluster_vol_handler }}"
  13. listen: gluster_vol_restart
  14. - name: "Stop {{ gluster_vol_name }}"
  15. gluster.gluster.gluster_volume:
  16. state: stopped
  17. name: "{{ gluster_vol_name }}"
  18. run_once: true
  19. loop: "{{ gluster_vol_handler }}"
  20. when: gluster_vol_stopped.changed
  21. listen: gluster_vol_restart