530d81bc056fa05c106c1855c216a7c6d82b77b8
[awsible] / roles / common / tasks / volumes.yml
1 ---
2 # set up a common /data directory for ephemeral or EBS volume
3 - stat: path=/media/data
4 register: dpstat
5 - set_fact: data_mount_path={{ dpstat.stat.path }}
6 when: dpstat.stat.exists and data_mount_path is undefined
7
8 - stat: path=/media/ephemeral0
9 register: dpstat
10 - set_fact: data_mount_path={{ dpstat.stat.path }}
11 when: dpstat.stat.exists and data_mount_path is undefined
12
13 - stat: path=/media/ephemeral1
14 register: dpstat
15 - set_fact: data_mount_path={{ dpstat.stat.path }}
16 when: dpstat.stat.exists and data_mount_path is undefined
17
18 - stat: path=/mnt
19 register: dpstat
20 - set_fact: data_mount_path={{ dpstat.stat.path }}
21 when: dpstat.stat.exists and data_mount_path is undefined
22
23 - name: Establish /data link to volume.
24 when: data_mount_path is defined
25 file:
26 state: link
27 path: /data
28 src: "{{ data_mount_path }}"
29 owner: ec2-user
30 group: ec2-user