--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2a820d5c-9f2d-4a3f-9b84-6515ca1978d2n%40googlegroups.com.
- hosts: localhost
name: Create a CloudFront distribution for UI components bucket
roles:
- common
- aws
connection: local
gather_facts: True
vars:
node_runtime: "nodejs12.x"
cdn_lambda_name: "AddHeadersToCDNResponses-{{ ec2_tag_environment }}"
tasks:
# Get web vars so we can set the CDN URL correctly
- include_vars: environment/{{ ec2_tag_environment }}/web_vars.yml
- include_vars: aws_s3_bucket_names.yml
- set_fact:
aws_cloudfront_cname: "cdn.{{ cloud_web_domain }}"
- debug: var=aws_cloudfront_cname
- name: Create IAM role for CloudFront lambda function
iam:
profile: "{{ aws_profile_name }}"
iam_type: role
name: CloudFront-Lambda-{{ ec2_tag_environment }}
state: present
trust_policy_filepath: templates/aws-cloudfront-lambda-role.j2
register: lambda_role_facts
- debug: var=lambda_role_facts
- name: Create a zip archive of the AddHeadersToCDNResponses lambda function
archive:
path: aws_lambda_code/AddHeadersToCDNResponses/*
dest: aws_lambda_code/AddHeadersToCDNResponses.zip
format: zip
- name: Get lambda info if it already exists
lambda_facts:
query: config
function_name: "{{ cdn_lambda_name }}"
profile: "{{ aws_profile_name }}"
region: "{{ aws_region }}"