我正在尝试使用Ansible自动化Amazon Cloudfront发行版的配置。当前,我需要在Amazon Certificate Manager中查找证书的ARN(Amazon资源名称),并将ARN存储为变量,以便以后在Cloudfront发行配置中使用。
我对此的查询如下:
- name: Check for existence of a certificate for this project in Amazon Certificate Manager
command: >
aws acm list-certificates
--profile "{{ project_name }}"-deploy
--region us-east-1
register: cert_list
ignore_errors: True
- name: Record list-certificates output to Json
set_fact:
this_project_arn: # I want to set this from the output of list-certficates
- debug: msg="{{ cert_list.stdout | from_json }}"
Run Code Online (Sandbox Code Playgroud)
该调试的输出当前如下:
TASK [configure-cloudfront : debug] ********************************************
ok: [localhost] => {
"msg": {
"CertificateSummaryList": [
{
"CertificateArn": "arn:aws:acm:us-east-1:123456789101:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"DomainName": …Run Code Online (Sandbox Code Playgroud)