Я работаю над тем, чтобы внести в черный список geo_locations с Ansible в Cloud Front. Мне удалось успешно получить идентификаторы распределения и показать сводку облачного фронта с этими идентификаторами, зацикливаясь в поле 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}}
Из того, что я могу сказать, это должно работать, так как команда basi c использует полученные идентификаторы и завершается.