I am trying to create a playbook to unmount an AFS mounted home directory, but I can't unmount it because the user running ansible has open files because of ansible. I can't do this with user with a local home, or ssh configs or anything like that. I need to do it with a regular ansible play and regular user, so no funky ssh configs or other changes to my hosts.
Here is my play:
- name: check if files are open in /afs
raw: "cd / && /usr/sbin/lsof /afs"
register: command_result
failed_when: "command_result.rc != 1"
If I run it with ansible, it will succeed, but ansible-playbook will show two processes spawned by the ansible run (sh and sudo).
Is there a way to change the current directory before tasks are run?
Thanks,
Jesse