IBM / ansible-power-aix

Developer contributions for Ansible Automation on Power
https://ibm.github.io/ansible-power-aix/
GNU General Public License v3.0
81 stars 95 forks source link

Fixed umount issue in case of NFS #557

Closed schamola closed 4 months ago

schamola commented 4 months ago

Fixes issue #417

nitismis commented 4 months ago

Please have a proper description, output and reasoning in a PR. It's a pain for us. Thanks !

schamola commented 4 months ago

Unmounting filesystems was sometimes not working as expected. Basically, when the options are not provided while mounting, "mount" command's output does not contain anything in the options column, thus this part of code fdirs.append(ln.split()[-6]) doesn't append the right filesystem to fdirs list.

This issue is solved if we iterate the output received from "mount" command from the beginning and take the second filesystem (having a "/" inside it, as all FS would contain a "/") which would basically be mount_over_dir value and will be later used to confirm if the fs is mounted or not. Attaching the task and output below for your reference.

Thanks!

PS: Let me know if any other clarification is required.

Playbook task:

 - name: Umount NFS '{{ NFSMOUNT }}'
      ibm.power_aix.mount:
        state: umount
        mount_over_dir: /check_mnt

Output:

image