community.aws.opensearch module – Creates OpenSearch or ElasticSearch domain
Note
This module is part of the community.aws collection (version 9.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
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.opensearch
.
New in community.aws 4.0.0
Synopsis
Creates or modify a Amazon OpenSearch Service domain.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.6
boto3 >= 1.28.0
botocore >= 1.31.0
Parameters
Parameter |
Comments |
---|---|
AWS access key ID. See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys. The The aws_access_key and profile options are mutually exclusive. The aws_access_key_id alias was added in release 5.1.0 for consistency with the AWS botocore SDK. The ec2_access_key alias has been deprecated and will be removed in a release after 2024-12-01. Support for the |
|
IAM access policy as a JSON-formatted string. |
|
Specifies advanced security options. |
|
True if advanced security is enabled. You must enable node-to-node encryption to use advanced security options. Choices:
|
|
True if the internal user database is enabled. Choices:
|
|
Credentials for the master user, username and password, ARN, or both. |
|
ARN for the master user (if IAM is enabled). |
|
The username of the master user, which is stored in the Amazon OpenSearch Service domain internal database. |
|
The password of the master user, which is stored in the Amazon OpenSearch Service domain internal database. |
|
The SAML application configuration for the domain. |
|
True if SAML is enabled. To use SAML authentication, you must enable fine-grained access control. You can only enable SAML authentication for OpenSearch Dashboards on existing domains, not during the creation of new ones. Domains only support one Dashboards authentication method at a time. If you have Amazon Cognito authentication for OpenSearch Dashboards enabled, you must disable it before you can enable SAML. Choices:
|
|
The SAML Identity Provider’s information. |
|
The unique entity ID of the application in SAML identity provider. |
|
The metadata of the SAML application in XML format. |
|
The backend role that the SAML master user is mapped to. |
|
The SAML master username, which is stored in the Amazon OpenSearch Service domain internal database. |
|
Element of the SAML assertion to use for backend roles. Default is roles. |
|
The duration, in minutes, after which a user session becomes inactive. Acceptable values are between 1 and 1440, and the default value is 60. |
|
Element of the SAML assertion to use for username. Default is NameID. |
|
If true, allow OpenSearch domain to be upgraded through one or more intermediate versions. If false, do not allow OpenSearch domain to be upgraded through intermediate versions. The upgrade operation fails if it’s not possible to ugrade to engine_version directly. Choices:
|
|
Specifies Auto-Tune options. |
|
The Auto-Tune desired state. Valid values are ENABLED and DISABLED. Choices:
|
|
A list of maintenance schedules. |
|
A cron expression for a recurring maintenance schedule. |
|
Specifies maintenance schedule duration, duration value and duration unit. |
|
The unit of a maintenance schedule duration. Valid value is HOURS. Choices:
|
|
Integer to specify the value of a maintenance schedule duration. |
|
The timestamp at which the Auto-Tune maintenance schedule starts. |
|
The location of a CA Bundle to use when validating SSL certificates. The |
|
A dictionary to modify the botocore configuration. Parameters can be found in the AWS documentation https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config. |
|
Parameters for the cluster configuration of an OpenSearch Service domain. |
|
An integer value to indicate the number of availability zones for a domain when zone awareness is enabled. This should be equal to number of subnets if VPC endpoints is enabled. |
|
Specifies the ColdStorageOptions config for a Domain. |
|
True to enable cold storage. Supported on Elasticsearch 7.9 or above. Choices:
|
|
A boolean value to indicate whether a dedicated master node is enabled. Choices:
|
|
Total number of dedicated master nodes, active and on standby, for the domain. |
|
The instance type for a dedicated master node. |
|
Number of instances for the domain. |
|
Type of the instances to use for the domain. |
|
The number of UltraWarm nodes in the domain. |
|
True to enable UltraWarm storage. Choices:
|
|
The instance type for the OpenSearch domain’s warm nodes. |
|
A boolean value to indicate whether zone awareness is enabled. Choices:
|
|
Parameters to configure OpenSearch Service to use Amazon Cognito authentication for OpenSearch Dashboards. |
|
The option to enable Cognito for OpenSearch Dashboards authentication. Choices:
|
|
The Cognito identity pool ID for OpenSearch Dashboards authentication. |
|
The role ARN that provides OpenSearch permissions for accessing Cognito resources. |
|
The Cognito user pool ID for OpenSearch Dashboards authentication. |
|
Use a The Choices:
|
|
Options to specify configuration that will be applied to the domain endpoint. |
|
The fully qualified domain for your custom endpoint. |
|
The ACM certificate ARN for your custom endpoint. |
|
Whether to enable a custom endpoint for the domain. Choices:
|
|
Whether only HTTPS endpoint should be enabled for the domain. Choices:
|
|
Specify the TLS security policy to apply to the HTTPS endpoint of the domain. |
|
The name of the Amazon OpenSearch/ElasticSearch Service domain. Domain names are unique across the domains owned by an account within an AWS region. |
|
Parameters to configure EBS-based storage for an OpenSearch Service domain. |
|
Specifies whether EBS-based storage is enabled. Choices:
|
|
The IOPD for a Provisioned IOPS EBS volume (SSD). |
|
Integer to specify the size of an EBS volume. |
|
Specifies the volume type for EBS-based storage. “standard”|”gp2”|”io1” |
|
Parameters to enable encryption at rest. |
|
Should data be encrypted while at rest. Choices:
|
|
If encryption at rest enabled, this identifies the encryption key to use. The value should be a KMS key ARN. It can also be the KMS key id. |
|
URL to connect to instead of the default AWS endpoints. While this can be used to connection to other AWS-compatible services the amazon.aws and community.aws collections are only tested against AWS. The The ec2_url and s3_url aliases have been deprecated and will be removed in a release after 2024-12-01. Support for the |
|
-> The engine version to use. For example, ‘ElasticSearch_7.10’ or ‘OpenSearch_1.1’. -> If the currently running version is not equal to engine_version, a cluster upgrade is triggered. -> It may not be possible to upgrade directly from the currently running version to engine_version. In that case, the upgrade is performed incrementally by upgrading to the highest compatible version, then repeat the operation until the cluster is running at the target version. -> The upgrade operation fails if there is no path from current version to engine_version. -> See OpenSearch documentation for upgrade compatibility. |
|
Node-to-node encryption options. |
|
True to enable node-to-node encryption. Choices:
|
|
A named AWS profile to use for authentication. See the AWS documentation for more information about named profiles https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html. The The profile option is mutually exclusive with the aws_access_key, aws_secret_key and security_token options. |
|
If If the Tag keys beginning with Choices:
|
|
The AWS region to use. For global services such as IAM, Route53 and CloudFront, region is ignored. The See the Amazon AWS documentation for more information http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region. The Support for the |
|
AWS secret access key. See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys. The The secret_key and profile options are mutually exclusive. The aws_secret_access_key alias was added in release 5.1.0 for consistency with the AWS botocore SDK. The ec2_secret_key alias has been deprecated and will be removed in a release after 2024-12-01. Support for the |
|
AWS STS session token for use with temporary credentials. See the AWS documentation for more information about access tokens https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys. The The security_token and profile options are mutually exclusive. Aliases aws_session_token and session_token were added in release 3.2.0, with the parameter being renamed from security_token to session_token in release 6.0.0. The security_token, aws_security_token, and access_token aliases have been deprecated and will be removed in a release after 2024-12-01. Support for the |
|
Option to set time, in UTC format, of the daily automated snapshot. |
|
Integer value from 0 to 23 specifying when the service takes a daily automated snapshot of the specified Elasticsearch domain. |
|
Creates or modifies an existing OpenSearch domain. Deletes an OpenSearch domain. Choices:
|
|
A dictionary representing the tags to be applied to the resource. If the |
|
When set to Setting validate_certs=false is strongly discouraged, as an alternative, consider setting aws_ca_bundle instead. Choices:
|
|
Options to specify the subnets and security groups for a VPC endpoint. |
|
Specifies the security group ids for VPC endpoint. |
|
Specifies the subnet ids for VPC endpoint. |
|
Whether or not to wait for completion of OpenSearch creation, modification or deletion. Choices:
|
|
how long before wait gives up, in seconds. Default: |
Notes
Note
Caution: For modules, environment variables and configuration files are read from the Ansible ‘host’ context and not the ‘controller’ context. As such, files may need to be explicitly copied to the ‘host’. For lookup and connection plugins, environment variables and configuration files are read from the Ansible ‘controller’ context and not the ‘host’ context.
The AWS SDK (boto3) that Ansible uses may also read defaults for credentials and other settings, such as the region, from its configuration files in the Ansible ‘host’ context (typically
~/.aws/credentials
). See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html for more information.
Examples
- name: Create OpenSearch domain for dev environment, no zone awareness, no dedicated masters
community.aws.opensearch:
domain_name: "dev-cluster"
engine_version: Elasticsearch_1.1
cluster_config:
instance_type: "t2.small.search"
instance_count: 2
zone_awareness: false
dedicated_master: false
ebs_options:
ebs_enabled: true
volume_type: "gp2"
volume_size: 10
access_policies: "{{ lookup('file', 'policy.json') | from_json }}"
- name: Create OpenSearch domain with dedicated masters
community.aws.opensearch:
domain_name: "my-domain"
engine_version: OpenSearch_1.1
cluster_config:
instance_type: "t2.small.search"
instance_count: 12
dedicated_master: true
zone_awareness: true
availability_zone_count: 2
dedicated_master_instance_type: "t2.small.search"
dedicated_master_instance_count: 3
warm_enabled: true
warm_type: "ultrawarm1.medium.search"
warm_count: 1
cold_storage_options:
enabled: false
ebs_options:
ebs_enabled: true
volume_type: "io1"
volume_size: 10
iops: 1000
vpc_options:
subnets:
- "subnet-e537d64a"
- "subnet-e537d64b"
security_groups:
- "sg-dd2f13cb"
- "sg-dd2f13cc"
snapshot_options:
automated_snapshot_start_hour: 13
access_policies: "{{ lookup('file', 'policy.json') | from_json }}"
encryption_at_rest_options:
enabled: false
node_to_node_encryption_options:
enabled: false
auto_tune_options:
enabled: true
maintenance_schedules:
- start_at: "2025-01-12"
duration:
value: 1
unit: "HOURS"
cron_expression_for_recurrence: "cron(0 12 * * ? *)"
- start_at: "2032-01-12"
duration:
value: 2
unit: "HOURS"
cron_expression_for_recurrence: "cron(0 12 * * ? *)"
tags:
Environment: Development
Application: Search
wait: true
- name: Increase size of EBS volumes for existing cluster
community.aws.opensearch:
domain_name: "my-domain"
ebs_options:
volume_size: 5
wait: true
- name: Increase instance count for existing cluster
community.aws.opensearch:
domain_name: "my-domain"
cluster_config:
instance_count: 40
wait: true