Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions roles/aws/aws_cloudfront_distribution/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
---
# Uncomment cf_acl to create firewall rules for Cloudfront distro
#cf_acl:
# rate_limit: 600
# scope: "CLOUDFRONT" # Can be "REGIONAL"
# region: "us-east-1" # If scope is set to CLOUDFRONT, region must be us-east-1, even though docs say it will be skipped
#
# ip_allow
# name: "Allowed-ips"
# list:
# - 1.1.1.1/32
# - 2.2.2.2/32
# - 3.3.3.3/32
#
# ip_block:
# name: "Blocked-ips"
# list:
# - 4.4.4.4/32
# - 5.5.5.5/32
# - 6.6.6.6/32
#
# cc_block_list:
# - BY # Belarus
# - CN # China
# - IR # Iran
# - SA # Saudi Arabia
aws_cloudfront_distribution:
aws_profile: "{{ _aws_profile }}"
region: "{{ _aws_region }}"
Expand Down Expand Up @@ -61,3 +86,8 @@ aws_cloudfront_distribution:
cache_behaviors: [] # A list of cache behaviors same as default_cache_behavior with additional path_pattern var required.
enabled: true
purge_existing: true # Set to false to append entries instead of replacing them.
# logging:
# bucket: "" # URL of S3 bucket to store logs
# enabled: false # Set true to allow logging
# include_cookies: false # Set true to add cookies in logs
# prefix: "" # Prefix for S3 object names
2 changes: 1 addition & 1 deletion roles/aws/aws_cloudfront_distribution/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
purge_origins: "{{ aws_cloudfront_distribution.purge_existing }}"
purge_aliases: "{{ aws_cloudfront_distribution.purge_existing }}"
purge_tags: "{{ aws_cloudfront_distribution.purge_existing }}"
logging: "{{ aws_cloudfront_distribution.logging }}"
logging: "{{ aws_cloudfront_distribution.logging | default('') }}"
purge_cache_behaviors: "{{ aws_cloudfront_distribution.purge_existing }}"
enabled: "{{ aws_cloudfront_distribution.enabled }}"
register: _aws_cloudfront_distribution