community.aws.opensearch module – Creates OpenSearch or ElasticSearch domain
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.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.
boto3 >= 1.18.0
botocore >= 1.21.0
botocore >= 1.21.38
python >= 3.6
Parameters
Parameter |
Comments |
|---|---|
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 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. |
|
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 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:
|
|
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 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. |
|
-> 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:
|
|
The profile option is mutually exclusive with the aws_access_key, aws_secret_key and security_token options. |
|
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. |
|
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 tags parameter is not set then tags will not be modified. |
|
When set to “no”, SSL certificates will not be validated for communication with the AWS APIs. 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: 300 |
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: 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