How to mount cifs [ansible]
March 31, 2020 Leave a comment
Simple ansible play too mount samba/cifs share using credential file.
- name: "mount share" mount: state: "mounted" fstype: "cifs" name: /mnt/win/ src: "//192.168.1.86/instshare" opts: "credentials=/root/.smb_passwords,file_mode=0644,dir_mode=0755,gid=root,uid=root"
Credential file looks like
# cat /root/.smb_passwords username=my_name password=strong_password
It’s also usefull to umount folder
- name: Unmount mount: path: /mnt/win/ state: unmounted