mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
DCD-224: Add fetching of EC2 metadata and generation of EFS mount from it.
This commit is contained in:
2
ansible.cfg
Normal file
2
ansible.cfg
Normal file
@@ -0,0 +1,2 @@
|
||||
[default]
|
||||
retry_files_enabled = False
|
||||
@@ -9,3 +9,4 @@
|
||||
- aws_linux2_common
|
||||
- aws_linux2_product_common
|
||||
- product_base
|
||||
- aws_efs_config
|
||||
|
||||
@@ -13,4 +13,3 @@ source $ENV_FILE
|
||||
set +a
|
||||
|
||||
ansible-playbook -v -i $INV $PLAYBOOK
|
||||
|
||||
|
||||
@@ -2,3 +2,9 @@
|
||||
java_version: "1.8.0"
|
||||
postgres_version: "9.6"
|
||||
git_version: "2.14.4"
|
||||
atl_shared_mountpoint: "/media/atl"
|
||||
|
||||
# The following are imports from the environment. These are generally
|
||||
# set in /etc/atl by the CloudFormation template and sourced before
|
||||
# Ansible is run.
|
||||
atl_efs_id: "{{ lookup('env', 'ATL_EFS_ID') }}"
|
||||
|
||||
2
roles/aws_efs_config/defaults/main.yml
Normal file
2
roles/aws_efs_config/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
efs_target: "{{ ansible_ec2_placement_availability_zone }}.{{ atl_efs_id }}.efs.{{ ansible_ec2_placement_region }}.amazonaws.com"
|
||||
3
roles/aws_efs_config/meta/main.yml
Normal file
3
roles/aws_efs_config/meta/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- aws_metadata
|
||||
13
roles/aws_efs_config/tasks/main.yml
Normal file
13
roles/aws_efs_config/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Enable mountpoint in fstab
|
||||
# lineinfile:
|
||||
# path: "/etc/fstab"
|
||||
# line: "{{ efs_target }}:/ /media/atl nfs4 rw,vers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0"
|
||||
# notify: mount_all
|
||||
mount:
|
||||
path: "{{ atl_shared_mountpoint }}"
|
||||
src: "{{ efs_target }}:/"
|
||||
fstype: nfs4
|
||||
opts: "rw,vers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2"
|
||||
state: mounted
|
||||
8
roles/aws_metadata/tasks/main.yml
Normal file
8
roles/aws_metadata/tasks/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
# This role is primarily intended to be depended on via `meta` by
|
||||
# roles that need runtime information available.
|
||||
|
||||
- name: Fetch local EC2 metadata
|
||||
ec2_metadata_facts:
|
||||
|
||||
@@ -4,3 +4,10 @@
|
||||
user:
|
||||
name: "{{ product_user }}"
|
||||
comment: "Product runtime user"
|
||||
|
||||
- name: Create mountpoint
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ atl_shared_mount }}"
|
||||
owner: "{{ product_user }}"
|
||||
mode: 0755
|
||||
|
||||
Reference in New Issue
Block a user