amazon.aws.route53_key_signing_key module – Manages a key-signing key (KSK)

Note

This module is part of the amazon.aws collection (version 10.0.0-dev0).

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 amazon.aws. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: amazon.aws.route53_key_signing_key.

New in amazon.aws 9.2.0

Synopsis

  • Creates a new key-signing key (KSK) associated with a hosted zone. You can only have two KSKs per hosted zone.

  • When state=absent, it deactivates and deletes a key-signing key (KSK).

  • Activates a key-signing key (KSK) so that it can be used for signing by DNSSEC.

  • Deactivates a key-signing key (KSK) so that it will not be used for signing by DNSSEC.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.6

  • boto3 >= 1.34.0

  • botocore >= 1.34.0

Parameters

Parameter

Comments

access_key

aliases: aws_access_key_id, aws_access_key

string

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 AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY environment variables may also be used in decreasing order of preference.

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.

aws_ca_bundle

path

The location of a CA Bundle to use when validating SSL certificates.

The AWS_CA_BUNDLE environment variable may also be used.

aws_config

dictionary

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.

caller_reference

string

A unique string that identifies the request.

Required when state=present.

debug_botocore_endpoint_logs

boolean

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:

  • false ← (default)

  • true

endpoint_url

aliases: aws_endpoint_url

string

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 AWS_URL environment variable may also be used.

hosted_zone_id

aliases: zone_id

string / required

The unique string (ID) used to identify a hosted zone.

key_management_service_arn

aliases: kms_arn

string

The Amazon resource name (ARN) for a customer managed key in Key Management Service (KMS).

Required when state=present.

name

string / required

A string used to identify a key-signing key (KSK).

profile

aliases: aws_profile

string

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 AWS_PROFILE environment variable may also be used.

The profile option is mutually exclusive with the aws_access_key, aws_secret_key and session_token options.

region

aliases: aws_region

string

The AWS region to use.

For global services such as IAM, Route53 and CloudFront, region is ignored.

The AWS_REGION environment variable may also be used.

See the Amazon AWS documentation for more information http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region.

secret_key

aliases: aws_secret_access_key, aws_secret_key

string

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 AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY environment variables may also be used in decreasing order of preference.

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.

session_token

aliases: aws_session_token

string

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 AWS_SESSION_TOKEN environment variable may also be used.

The session_token and profile options are mutually exclusive.

state

string

Whether or not the zone should exist.

Choices:

  • "present" ← (default)

  • "absent"

status

string

A string specifying the initial status of the key-signing key (KSK).

When state=presnent, you can set the value to ACTIVE or INACTIVE.

Choices:

  • "ACTIVE" ← (default)

  • "INACTIVE"

validate_certs

boolean

When set to false, SSL certificates will not be validated for communication with the AWS APIs.

Setting validate_certs=false is strongly discouraged, as an alternative, consider setting aws_ca_bundle instead.

Choices:

  • false

  • true ← (default)

wait

boolean

Wait until the changes have been replicated.

Choices:

  • false ← (default)

  • true

wait_timeout

integer

How long to wait for the changes to be replicated, in seconds.

Default: 300

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 a Key Signing Key Request
  amazon.aws.route53_ksk:
    name: "{{ resource_prefix }}-ksk"
    hosted_zone_id: "ZZZ1111112222"
    key_management_service_arn: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    caller_reference: "arn:aws:iam::123456789012:user/SomeUser"
    status: "INACTIVE"
    state: present

- name: Activate a Key Signing Key Request
  amazon.aws.route53_ksk:
    name: "{{ resource_prefix }}-ksk"
    hosted_zone_id: "ZZZ1111112222"
    key_management_service_arn: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    caller_reference: "arn:aws:iam::123456789012:user/SomeUser"
    status: "ACTIVE"
    state: present

- name: Delete a Key Signing Key Request and deactivate it
  amazon.aws.route53_ksk:
    name: "{{ resource_prefix }}-ksk"
    hosted_zone_id: "ZZZ1111112222"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

change_info

dictionary

A dictionary that describes change information about changes made to the hosted zone.

Returned: when a Key Signing Key is created or it exists and is updated/deleted

Sample: {"id": "/change/C090307813XORZJ5J3U4", "status": "PENDING", "submitted_at": "2024-12-04T15:15:36.743000+00:00"}

comment

string

A comment you can provide.

Returned: success

id

string

Change ID.

Returned: success

status

string

The current state of the request.

Returned: success

submitted_at

string

The date and time that the change request was submitted in ISO 8601 format and Coordinated Universal Time (UTC).

Returned: success

key_signing_key

dictionary

The key-signing key (KSK) that the request creates.

Returned: always

Sample: {"created_date": "2024-12-04T15:15:36.715000+00:00", "digest_algorithm_mnemonic": "SHA-256", "digest_algorithm_type": 2, "digest_value": "xxx", "dnskey_record": "xxx", "ds_record": "xxx", "flag": 257, "key_tag": 18948, "kms_arn": "arn:aws:kms:us-east-1:xxx:key/xxx", "last_modified_date": "2024-12-04T15:15:36.715000+00:00", "name": "ansible-test-44230979--ksk", "public_key": "xxxx", "signing_algorithm_mnemonic": "ECDSAP256SHA256", "signing_algorithm_type": 13, "status": "INACTIVE"}

created_date

string

The date when the key-signing key (KSK) was created.

Returned: success

digest_algorithm_mnemonic

string

A string used to represent the delegation signer digest algorithm.

Returned: success

digest_algorithm_type

integer

An integer used to represent the delegation signer digest algorithm.

Returned: success

digest_value

string

A cryptographic digest of a DNSKEY resource record (RR).

Returned: success

dnskey_record

string

A string that represents a DNSKEY record.

Returned: success

ds_record

string

A string that represents a delegation signer (DS) record.

Returned: success

flag

integer

An integer that specifies how the key is used.

Returned: success

key_tag

integer

An integer used to identify the DNSSEC record for the domain name.

Returned: success

kms_arn

string

The Amazon resource name (ARN) used to identify the customer managed key in Key Management Service (KMS).

Returned: success

last_modified_date

string

The last time that the key-signing key (KSK) was changed.

Returned: success

name

string

A string used to identify a key-signing key (KSK).

Returned: success

public_key

string

The public key, represented as a Base64 encoding.

Returned: success

signing_algorithm_mnemonic

string

A string used to represent the signing algorithm.

Returned: success

signing_algorithm_type

integer

An integer used to represent the signing algorithm.

Returned: success

status

string

A string that represents the current key-signing key (KSK) status.

Returned: success

status_message

string

The status message provided for ACTION_NEEDED or INTERNAL_FAILURE statuses.

Returned: success

location

string

The unique URL representing the new key-signing key (KSK).

Returned: when only a new Key Signing Key is created

Sample: "https://route53.amazonaws.com/2013-04-01/keysigningkey/xxx/ansible-test-ksk"

Authors

  • Alina Buzachis (@alinabuzachis)