0

I running HCL Packer to create Ubuntu 22.04 LTS image. I'm using ansible-local provisioner. The ansible playbook has following tasks (besides many others):

share_path: "/var/my_nfs"
tasks:
    - name: Create Share Directory
      become: yes
      file:
        path: "{{ share_path }}"
        state: directory
        mode: 777
        recurse: yes

    - name: Ensure share directory has correct permissions.
      become: true
      file:
        path: "{{ share_path }}"
        state: directory
        owner: www-data
        group: www-data

    - name: Mount File Share
      become: yes
      command: mount -t cifs //{{ storage_account_name }}.file.core.windows.net/{{ file_share_name }} {{ share_path }} -o "username={{ storage_account_name }},password={{ storage_account_key }},dir_mode=0777,file_mode=0777,serverino,uid=www-data,gid=www-data"

This last task is giving me hard time. I'm consistently getting the following error:

"mount error(13): Permission denied",
"Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)"

I have checked many times, the storage_account_name, file_share_name, storage_account_key are all correct.

I have checked connectivity over 445 port to the file share that is working as well.

Any clue what I'm missing here?

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188

1 Answers1

0

My problem was following 2 things:

  1. A faulty startup script changing ownership of everything in /bin directory to some non-root user group.
  2. Network connectivity.

I fixed the script and allowed outbound connectivity on port 445. Still not able to mount during image creation but it gets mounted when the VMSS is created or a new instance is spun up.

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188