【问题标题】:Issues with Cloud Front module with restrictionsCloud Front 模块存在限制问题
【发布时间】:2020-04-13 23:51:02
【问题描述】:

我正在努力在 Cloud Front 中使用 Ansible 将一些地理位置列入黑名单。我已经能够成功获取分发 ID 并显示云端摘要,这些 ID 循环到 distribution_id 字段中。

- name: Get Distributions
      cloudfront_info:
        aws_access_key: "{{access}}"
        aws_secret_key: "{{secret}}"
        security_token: "{{security}}"
        distribution_id: item
      loop: "{{cloudfront}}"
      register: info

但是当我用限制类调用同一个模块时,它告诉我没有这样的分布。

- name: Add restrictions
      cloudfront_distribution:
        aws_access_key: "{{access}}"
        aws_secret_key: "{{secret}}"
        security_token: "{{security}}"
        distribution_id: item
        restrictions:
          geo_restriction:
            restriction_type: "blacklist"
            items:
              - "CU"
              - "NI"
        state: present
      loop: "{{cloudfront}}"

这是完整的错误

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoSuchDistribution: An error occurred (NoSuchDistribution) when calling the GetDistribution operation: The specified distribution does not exist.
failed: [localhost] (item=xxxxxxx) => {"ansible_loop_var": "item", "boto3_version": "1.10.12", "botocore_version": "1.14.9", "changed": false, "error": {"code": "NoSuchDistribution", "message": "The specified distribution does not exist.", "type": "Sender"}, "item": "xxxxxx", "msg": "Error describing distribution: An error occurred (NoSuchDistribution) when calling the GetDistribution operation: The specified distribution does not exist.", "response_metadata": {"http_headers": {"content-length": "294", "content-type": "text/xml", "date": "Fri, 10 Apr 2020 15:42:55 GMT", "retry_attempts": 0}}

据我所知,它应该可以工作,因为基本命令会使用传入的 ID 并完成。

【问题讨论】:

    标签: amazon-web-services module ansible amazon-cloudfront restriction


    【解决方案1】:

    我已经解决了这个问题。需要拆分 distribution_id 对象,因为它不喜欢数组。

    【讨论】:

      猜你喜欢
      • 2021-10-08
      • 2020-03-30
      • 2019-07-12
      • 2019-10-14
      • 2017-07-28
      • 2023-03-28
      • 1970-01-01
      • 2019-10-12
      • 1970-01-01
      相关资源
      最近更新 更多