2022-02-27 03:19:20 +00:00
|
|
|
---
|
|
|
|
# Requires amazon-efs-utils; included, but should probably be split out?
|
|
|
|
#
|
2023-08-28 01:17:49 +00:00
|
|
|
- name: "Create directories"
|
|
|
|
ansible.builtin.file:
|
|
|
|
name: "{{ item.mount_point }}"
|
|
|
|
mode: '0755'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
state: directory
|
2022-02-27 03:19:20 +00:00
|
|
|
|
2023-08-28 04:02:36 +00:00
|
|
|
- name: "Install rocky-release-cloud"
|
|
|
|
become: true
|
|
|
|
become_user: root
|
|
|
|
ansible.builtin.dnf:
|
|
|
|
name: "rocky-release-cloud"
|
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- amazon_efs_utils
|
|
|
|
- packages
|
|
|
|
- mounts
|
|
|
|
|
2022-02-27 03:19:20 +00:00
|
|
|
- name: "Installing amazon-efs-utils"
|
|
|
|
become: true
|
|
|
|
become_user: root
|
2022-03-28 05:01:23 +00:00
|
|
|
ansible.builtin.dnf:
|
2023-08-28 04:02:36 +00:00
|
|
|
name: "amazon-efs-utils"
|
2022-02-27 03:19:20 +00:00
|
|
|
state: present
|
|
|
|
tags:
|
|
|
|
- amazon_efs_utils
|
|
|
|
- packages
|
|
|
|
- mounts
|
|
|
|
|
|
|
|
- name: "Gathering ec2 facts"
|
|
|
|
amazon.aws.ec2_metadata_facts:
|
|
|
|
tags:
|
|
|
|
- mounts
|
|
|
|
|
|
|
|
# "you can use /etc/hosts" https://github.com/aws/efs-utils/issues/1
|
|
|
|
- name: "Install custom hosts file because fmlC-w amazon said so."
|
|
|
|
become: true
|
|
|
|
become_user: root
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/hosts
|
|
|
|
line: "{{ item.ip_map[ansible_ec2_placement_availability_zone] }} {{ item.fsid }}.efs.{{ ansible_ec2_placement_region }}.amazonaws.com"
|
|
|
|
create: true
|
|
|
|
tags:
|
|
|
|
- mounts
|
|
|
|
|
|
|
|
- name: "Creating and mounting {{ item.fsid }} at {{ item.mount_point }}"
|
|
|
|
become: true
|
|
|
|
become_user: root
|
|
|
|
ansible.posix.mount:
|
|
|
|
path: "{{ item.mount_point }}"
|
|
|
|
src: "{{ item.fsid }}:/"
|
|
|
|
fstype: "{{ item.fstype }}"
|
|
|
|
opts: "{{ item.fsopts | join(',') }}"
|
|
|
|
state: "{{ item.state | default('mounted') }}"
|
|
|
|
tags:
|
|
|
|
- mounts
|
|
|
|
...
|