2021-07-12 04:16:19 +00:00
|
|
|
---
|
|
|
|
# Requires amazon-efs-utils; included, but should probably be split out?
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: "Installing amazon-efs-utils"
|
2021-08-30 05:02:24 +00:00
|
|
|
become: true
|
2021-07-12 04:16:19 +00:00
|
|
|
become_user: root
|
|
|
|
yum:
|
|
|
|
name: 'https://git.rockylinux.org/neil/efs-utils/-/jobs/5/artifacts/raw/build/amazon-efs-utils-1.30.1-1.el8.noarch.rpm?inline=false'
|
2021-08-30 05:02:24 +00:00
|
|
|
disable_gpg_check: true
|
|
|
|
validate_certs: true
|
2021-07-12 04:16:19 +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."
|
2021-08-30 05:02:24 +00:00
|
|
|
become: true
|
2021-07-12 04:16:19 +00:00
|
|
|
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"
|
2021-08-30 05:02:24 +00:00
|
|
|
create: true
|
2021-07-12 04:16:19 +00:00
|
|
|
tags:
|
|
|
|
- mounts
|
|
|
|
|
|
|
|
- name: "Creating and mounting {{ item.fsid }} at {{ item.mount_point }}"
|
2021-08-30 05:02:24 +00:00
|
|
|
become: true
|
2021-07-12 04:16:19 +00:00
|
|
|
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
|
2021-08-30 05:02:24 +00:00
|
|
|
...
|