community.aws.efs module – create and maintain EFS file systems
Note
This module is part of the community.aws collection (version 5.0.0).
To install it, use: ansible-galaxy collection install community.aws.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.aws.efs.
New in community.aws 1.0.0
Synopsis
Module allows create, search and destroy Amazon EFS file systems.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.6
boto3 >= 1.18.0
botocore >= 1.21.0
Parameters
Parameter |
Comments |
|---|---|
The aws_access_key and profile options are mutually exclusive. |
|
The location of a CA Bundle to use when validating SSL certificates. Note: The CA Bundle is read ‘module’ side and may need to be explicitly copied from the controller if not run locally. |
|
A dictionary to modify the botocore configuration. Parameters can be found at https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config. |
|
The aws_secret_key and profile options are mutually exclusive. |
|
Use a botocore.endpoint logger to parse the unique (rather than total) “resource:action” API calls made during a task, outputing the set to the resource_actions key in the task results. Use the aws_resource_action callback to output to total list made during a playbook. The ANSIBLE_DEBUG_BOTOCORE_LOGS environment variable may also be used. Choices:
|
|
If encrypt=true creates an encrypted file system. This can not be modified after the file system is created. Choices:
|
|
URL to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used. |
|
ID of Amazon EFS. Either name or ID required for delete. |
|
The id of the AWS KMS CMK that will be used to protect the encrypted file system. This parameter is only required if you want to use a non-default CMK. If this parameter is not specified, the default CMK for Amazon EFS is used. The key id can be Key ID, Key ID ARN, Key Alias or Key Alias ARN. |
|
Creation Token of Amazon EFS file system. Required for create and update. Either name or ID required for delete. |
|
File system’s performance mode to use. Only takes effect during creation. Choices:
|
|
The profile option is mutually exclusive with the aws_access_key, aws_secret_key and security_token options. |
|
If the throughput_mode is provisioned, select the amount of throughput to provisioned in Mibps. |
|
If purge_tags=true and tags is set, existing tags will be purged from the resource to match exactly what is defined by tags parameter. If the tags parameter is not set then tags will not be modified, even if purge_tags=True. Tag keys beginning with Choices:
|
|
The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region |
|
The security_token and profile options are mutually exclusive. Aliases aws_session_token and session_token have been added in version 3.2.0. |
|
Allows to create, search and destroy Amazon EFS file system. Choices:
|
|
List of tags of Amazon EFS. Should be defined as dictionary In case of ‘present’ state with list of tags and existing EFS (matched by ‘name’), tags of EFS will be replaced with provided data. |
|
List of mounted targets. It should be a list of dictionaries, every dictionary should include next attributes: This data may be modified for existing EFS using state ‘present’ and new list of mount targets. |
|
A valid IPv4 address within the address range of the specified subnet. |
|
List of security group IDs, of the form ‘sg-xxxxxxxx’. These must be for the same VPC as subnet specified |
|
The ID of the subnet to add the mount target in. |
|
The throughput_mode for the file system to be created. Choices:
|
|
How many days before objects transition to the lower-cost EFS Infrequent Access (IA) storage class. If set to the string If this parameter is absent, any existing lifecycle policy will not be affected. Choices:
|
|
When set to “no”, SSL certificates will not be validated for communication with the AWS APIs. Choices:
|
|
In case of ‘present’ state should wait for EFS ‘available’ life cycle state (of course, if current state not ‘deleting’ or ‘deleted’) In case of ‘absent’ state should wait for EFS ‘deleted’ life cycle state Choices:
|
|
How long the module should wait (in seconds) for desired state before returning. Zero means wait as long as necessary. Default: 0 |
Notes
Note
If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence
AWS_URLorEC2_URL,AWS_PROFILEorAWS_DEFAULT_PROFILE,AWS_ACCESS_KEY_IDorAWS_ACCESS_KEYorEC2_ACCESS_KEY,AWS_SECRET_ACCESS_KEYorAWS_SECRET_KEYorEC2_SECRET_KEY,AWS_SECURITY_TOKENorEC2_SECURITY_TOKEN,AWS_REGIONorEC2_REGION,AWS_CA_BUNDLEWhen no credentials are explicitly provided the AWS SDK (boto3) that Ansible uses will fall back to its configuration files (typically
~/.aws/credentials). See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html for more information.AWS_REGIONorEC2_REGIONcan be typically be used to specify the AWS region, when required, but this can also be defined in the configuration files.
Examples
- name: EFS provisioning
community.aws.efs:
state: present
name: myTestEFS
tags:
Name: myTestNameTag
purpose: file-storage
targets:
- subnet_id: subnet-748c5d03
security_groups: [ "sg-1a2b3c4d" ]
- name: Modifying EFS data
community.aws.efs:
state: present
name: myTestEFS
tags:
name: myAnotherTestTag
targets:
- subnet_id: subnet-7654fdca
security_groups: [ "sg-4c5d6f7a" ]
- name: Set a lifecycle policy
community.aws.efs:
state: present
name: myTestEFS
transition_to_ia: 7
targets:
- subnet_id: subnet-7654fdca
security_groups: [ "sg-4c5d6f7a" ]
- name: Remove a lifecycle policy
community.aws.efs:
state: present
name: myTestEFS
transition_to_ia: None
targets:
- subnet_id: subnet-7654fdca
security_groups: [ "sg-4c5d6f7a" ]
- name: Deleting EFS
community.aws.efs:
state: absent
name: myTestEFS
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
timestamp of creation date Returned: always Sample: “2015-11-16 07:30:57-05:00” |
|
EFS creation token Returned: always Sample: “console-88609e04-9a0e-4a2e-912c-feaa99509961” |
|
ID of the file system Returned: always Sample: “fs-xxxxxxxx” |
|
url of file system valid for use with mount Returned: always Sample: “fs-xxxxxxxx.efs.us-west-2.amazonaws.com:/” |
|
state of the EFS file system Returned: always Sample: “creating, available, deleting, deleted” |
|
url of file system with leading dot from the time when AWS EFS required to add a region suffix to the address Returned: always Sample: “.fs-xxxxxxxx.efs.us-west-2.amazonaws.com:/” |
|
list of mount targets Returned: always Sample: [{“file_system_id”: “fs-a7ad440e”, “ip_address”: “172.31.17.173”, “life_cycle_state”: “available”, “mount_target_id”: “fsmt-d8907871”, “network_interface_id”: “eni-6e387e26”, “owner_id”: “123456789012”, “security_groups”: [“sg-a30b22c6”], “subnet_id”: “subnet-e265c895”}, “…”] |
|
name of the file system Returned: always Sample: “my-efs” |
|
the number of targets mounted Returned: always Sample: 3 |
|
AWS account ID of EFS owner Returned: always Sample: “XXXXXXXXXXXX” |
|
performance mode of the file system Returned: always Sample: “generalPurpose” |
|
size of the file system in bytes as of a timestamp Returned: always Sample: {“timestamp”: “2015-12-21 13:59:59-05:00”, “value”: 12288} |
|
tags on the efs instance Returned: always Sample: {“key”: “Value”, “name”: “my-efs”} |