From: Justin Wind Date: Fri, 8 Sep 2017 19:17:46 +0000 (-0700) Subject: add mount-efs role X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=8f8b35ec9c80814a000d7cb479a9fbf475800273;p=awsible add mount-efs role --- diff --git a/roles/mount-efs/defaults/main.yml b/roles/mount-efs/defaults/main.yml new file mode 100644 index 0000000..c4d6604 --- /dev/null +++ b/roles/mount-efs/defaults/main.yml @@ -0,0 +1,2 @@ +--- +efs_mount_path: /media/data diff --git a/roles/mount-efs/tasks/main.yml b/roles/mount-efs/tasks/main.yml new file mode 100644 index 0000000..788c496 --- /dev/null +++ b/roles/mount-efs/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- name: Install NFS tools + yum: + name: nfs-utils + +- name: Mount path + file: + path: "{{ efs_mount_path }}" + state: directory + owner: ec2-user + group: ec2-user + mode: "0755" + +- name: current AZ + check_mode: no + uri: + url: http://169.254.169.254/latest/meta-data/placement/availability-zone + return_content: yes + register: aws_current_az + +- name: Mount EFS volume + mount: + name: "{{ efs_mount_path }}" + src: "{{ efs_id }}.efs.{{ aws_current_az.content[:-1] }}.amazonaws.com:/" + fstype: nfs4 + opts: "nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,_netdev" + passno: 0 + dump: 0 + state: mounted