Search code examples
ansibleazure-storage

Azure file share mount with Ansible


I would like to mount Azure file share via Ansible. If I'm mounting manually then the command is as below:

sudo mount -t cifs //xxxxxxxxxx.file.core.windows.net/yyyyyyyyyy /<mount point> -o vers=2.1,username=<username>,password=<password>,dir_mode=0777,file_mode=0777,serverino

Can someone help me to make this mount via Ansible using the mount module.


Solution

  • Just use the syntax as described in ansible docs for Mount Module and it should work.

    Example:

    - name : Mount Azure files share's
      mount:
        fstype: cifs
        src: "//xxxxxxxxxx.file.core.windows.net/yyyyyyyyyy"
        path: /mountpoint
        opts: vers=2.1,username=<username>,password=<password>,dir_mode=0777,file_mode=0777,serverino
        state: mounted