add mount-efs role
[awsible] / roles / mount-efs / tasks / main.yml
1 ---
2 - name: Install NFS tools
3 yum:
4 name: nfs-utils
5
6 - name: Mount path
7 file:
8 path: "{{ efs_mount_path }}"
9 state: directory
10 owner: ec2-user
11 group: ec2-user
12 mode: "0755"
13
14 - name: current AZ
15 check_mode: no
16 uri:
17 url: http://169.254.169.254/latest/meta-data/placement/availability-zone
18 return_content: yes
19 register: aws_current_az
20
21 - name: Mount EFS volume
22 mount:
23 name: "{{ efs_mount_path }}"
24 src: "{{ efs_id }}.efs.{{ aws_current_az.content[:-1] }}.amazonaws.com:/"
25 fstype: nfs4
26 opts: "nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,_netdev"
27 passno: 0
28 dump: 0
29 state: mounted