Browse Source

Initial Commit

tags/0.0.1^2
PHELEP Gwenael 2 years ago
parent
commit
25b247f6ca
9 changed files with 208 additions and 1 deletions
  1. +0
    -0
      Jenkinsfile
  2. +21
    -0
      LICENSE
  3. +58
    -1
      README.md
  4. +24
    -0
      defaults/main.yml
  5. +1
    -0
      meta/.galaxy_install_info
  6. +68
    -0
      meta/main.yml
  7. +32
    -0
      tasks/main.yml
  8. +2
    -0
      vars/Debian.yml
  9. +2
    -0
      vars/RedHat.yml

+ 0
- 0
Jenkinsfile View File


+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 58
- 1
README.md View File

@@ -1,2 +1,59 @@
# ansible-role-aws-nfs
ansible-role-aws-efs
====================

Mount EFS volume for CentOS / RHEL / Debian.

Requirements
------------

N/A

Role Variables
--------------

Mount mappings

Notes:
- Filesystem must be in the same security group with the EC2 instances using it

Options:
- path: Local path to mount target folder in your EC2 instance
- owner: Owner of the folder (default value "root")
- group: Group of the folder (default value "root")
- mode: Permissions for the folder (default value "0644")
- region: In what region filesystem is
- filesystem_id: Filesystem ID

Dependencies
------------

N/A

Example Playbook
----------------

```yaml
tasks:
- name: 'Mount EFS volume'
vars:
aws_efs_paths:
- path: '/data/mft'
owner: 'ec2-user'
group: 'ec2-user'
mode: '0755'
region: 'ca-central-1'
filesystem_id: 'fs-8da74460'

include_role:
name: ansible-role-aws-efs
```

License
-------

MIT

Author Information
------------------

FXInnovation Inc

+ 24
- 0
defaults/main.yml View File

@@ -0,0 +1,24 @@
---
# Mount mappings
#
# Notes:
# - Filesystem must be in the same security group with the EC2 instances using it
# - Currently EFS is only available in Ireland and US (8.7.2016)
#
# Options:
# - path: Local path to mount target folder in your EC2 instance
# - owner: Owner of the folder (default value "root")
# - group: Group of the folder (default value "root")
# - mode: Permissions for the folder (default value "0644")
# - region: In what region filesystem is
# - filesystem_id: Filesystem ID

# Mount paths

aws_efs_paths:
- path: ''
owner: ''
group: ''
mode: ''
region: ''
filesystem_id: ''

+ 1
- 0
meta/.galaxy_install_info View File

@@ -0,0 +1 @@
{install_date: 'Thu May 23 20:56:30 2019', version: 0.0.1}

+ 68
- 0
meta/main.yml View File

@@ -0,0 +1,68 @@
galaxy_info:
author: FXInnovation Inc
description: Mount EFS volumes for CentOS / RHEL / Debian.
company: FXInnovation Inc

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: MIT

min_ansible_version: 2.7

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
platforms:
- name: RedHat
versions:
- 7
- name: Debian
- name: EL
versions:
- 7

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

+ 32
- 0
tasks/main.yml View File

@@ -0,0 +1,32 @@
---
- name: Include OS-specific variables
include_vars: "{{ ansible_os_family }}.yml"

- name: Ensure NFS is installed
package:
name: "{{ nfs_package }}"
state: present

- name: Ensure mount directories exist
file:
path: "{{ item.path }}"
state: directory
mode: "{{ item.mode }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
loop: "{{ aws_efs_paths }}"

- name: Get current Availibity Zone from AWS
uri:
url: http://169.254.169.254/latest/meta-data/placement/availability-zone
return_content: yes
register: availability_zone

- name: Ensure EFS volume is mounted
mount:
name: "{{ item.path }}"
src: "{{ availability_zone.content }}.{{ item.filesystem_id }}.efs.{{ item.region }}.amazonaws.com:/"
fstype: nfs4
opts: nfsvers=4.1
state: mounted
loop: "{{ aws_efs_paths }}"

+ 2
- 0
vars/Debian.yml View File

@@ -0,0 +1,2 @@
---
nfs_package: nfs-common

+ 2
- 0
vars/RedHat.yml View File

@@ -0,0 +1,2 @@
---
nfs_package: nfs-utils

Loading…
Cancel
Save