Oliyavan
Oliyavan

Reputation: 11

AWS EFS filsystem mounting issue via anislbe-playbook

we installed efs utility and configured the EFS filesystem with EFS Mount points with in the VPC. Added the entry in /etc/fstab for permanent mount like below.

echo "mount fs-xxxxxxx /mnt/efs efs tls,_netdev 0 0" >> /etc/fstab

after this when i manually run the mount -a -t efs defaults - it is working fine file system got mounted successfully without any issue.

But when i try to invoke the same thing from ansible mount module like below

- name: Mount up efs
  mount:
    path: /mnt/efs
    src: fs-xxxxxxxx
    fstype: efs
    opts: tls
    state: mounted
  become: true
  become_method: pbrun
  become_user: root

Note: Ansible is running as root privilaged user on the target host.

Expected Result: EFS filesystem should get mounted without any issue.

Actual Result: We are getting error in ansible saying like

Error:
only root can run mount.efs

when i start debugging the issue i see the entry in init.py for efs https://github.com/aws/efs-utils/blob/555154b79572cd2a9f63782cac4c1062eb9b1ebd/src/mount_efs/init.py

we are validating the user with getpass python module but some how even i am using the become in the ansible it is not help me to get ride of this error.

Could you please anyone help me to resolve tis issue

Upvotes: 1

Views: 1696

Answers (1)

tekgirl77
tekgirl77

Reputation: 11

Either the fstype is nfs or you may need to install the EFS Mount Helper.

Upvotes: 1

Related Questions