community.aws.cloudfront_origin_access_identity 模块 – 为 CloudFront 分发创建、更新和删除源访问标识
注意
此模块是 community.aws 集合 (版本 9.0.0) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.aws
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.aws.cloudfront_origin_access_identity
。
community.aws 1.0.0 中的新增功能
概要
允许轻松创建、更新和删除源访问标识。
要求
在执行此模块的主机上需要以下要求。
python >= 3.6
boto3 >= 1.28.0
botocore >= 1.31.0
参数
参数 |
注释 |
---|---|
AWS 访问密钥 ID。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 还可以按优先级递减的顺序使用 aws_access_key 和 profile 选项是互斥的。 为与 AWS botocore SDK 保持一致,在 5.1.0 版本中添加了 aws_access_key_id 别名。 ec2_access_key 别名已弃用,并将在 2024-12-01 之后的一个版本中删除。
|
|
验证 SSL 证书时要使用的 CA 捆绑包的位置。 还可以使用 |
|
用于修改 botocore 配置的字典。 参数可在 AWS 文档中找到 https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config。 |
|
一个唯一的标识符,用于引用源访问标识。 |
|
描述 CloudFront 源访问标识的注释。 |
|
使用 还可以使用 选项
|
|
连接到默认 AWS 端点以外的 URL。虽然这可以用于连接到其他与 AWS 兼容的服务,但 amazon.aws 和 community.aws 集合仅针对 AWS 进行了测试。 还可以按优先级递减的顺序使用 ec2_url 和 s3_url 别名已弃用,并将在 2024-12-01 之后的一个版本中删除。
|
|
CloudFront 分发的 origin_access_identity_id。 |
|
用于身份验证的命名 AWS 配置文件。 有关命名配置文件的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html。 还可以使用 profile 选项与 aws_access_key、aws_secret_key 和 security_token 选项互斥。 |
|
要使用的 AWS 区域。 对于诸如 IAM、Route53 和 CloudFront 之类的全球服务,将忽略 region。 还可以使用 有关更多信息,请参见 Amazon AWS 文档 http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region。 别名 对环境变量 |
|
AWS 密钥。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 也可以使用环境变量 secret_key 和 profile 选项互斥。 为了与 AWS botocore SDK 保持一致,别名 aws_secret_access_key 在 5.1.0 版本中添加。 别名 ec2_secret_key 已弃用,将在 2024-12-01 之后的发行版中移除。 对环境变量 |
|
用于临时凭证的 AWS STS 会话令牌。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 也可以使用环境变量 security_token 和 profile 选项互斥。 别名 aws_session_token 和 session_token 在 3.2.0 版本中添加,参数名称在 6.0.0 版本中从 security_token 重命名为 session_token。 别名 security_token、aws_security_token 和 access_token 已弃用,将在 2024-12-01 之后的发行版中移除。 对环境变量 |
|
指定命名资源是否存在。 选项
|
|
设置为 强烈建议不要设置 validate_certs=false,作为替代方案,请考虑设置 aws_ca_bundle。 选项
|
备注
注意
不支持检查模式。
注意:对于模块,环境变量和配置文件是从 Ansible 的“主机”上下文而不是“控制器”上下文读取的。因此,可能需要显式地将文件复制到“主机”。对于查找和连接插件,环境变量和配置文件是从 Ansible 的“控制器”上下文而不是“主机”上下文读取的。
Ansible 使用的 AWS SDK (boto3) 也可能从 Ansible“主机”上下文中的配置文件(通常为
~/.aws/credentials
)读取凭据和其他设置(例如区域)的默认值。有关更多信息,请参见 https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html。
示例
- name: create an origin access identity
community.aws.cloudfront_origin_access_identity:
state: present
caller_reference: this is an example reference
comment: this is an example comment
- name: update an existing origin access identity using caller_reference as an identifier
community.aws.cloudfront_origin_access_identity:
origin_access_identity_id: E17DRN9XUOAHZX
caller_reference: this is an example reference
comment: this is a new comment
- name: delete an existing origin access identity using caller_reference as an identifier
community.aws.cloudfront_origin_access_identity:
state: absent
caller_reference: this is an example reference
comment: this is a new comment
返回值
常见返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
源访问标识符的信息。 返回:始终返回 |
|
描述指定源访问标识符的 URL。 返回:始终返回 |
|
OAI 的调用者引用 返回:始终返回 |
|
描述 OAI 的注释 返回:始终返回 |
|
OAI 的唯一标识符 返回:始终返回 |
|
创建 OAI 的用户的规范用户 ID 返回:始终返回 |
|
创建的源访问标识符的当前版本。 返回:始终返回 |
|
新创建的源访问标识符的完全限定 URI。 返回:首次创建时返回 |