Hi all,
My cloudformation template has exceeded the template body limit more than 51200 bytes and I am trying to upload to s3 and deploy using cross account. I used template_url parameter in the playbook but giving an error. Before adding template_url, I had template_body which was working fine. I have only replaced template_body to template_url.
Please find the playbook below:
-
name: create xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles changeset
cloudformation:
stack_name: “xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles”
state: present
region: “{{ account_config.1 }}”
aws_access_key: “{{ account_config.0.sts_creds.access_key }}”
aws_secret_key: “{{ account_config.0.sts_creds.secret_key }}”
security_token: “{{ account_config.0.sts_creds.session_token }}”
create_changeset: true
changeset_name: “{{ cf_changeset_name }}”
template_url: “https://s3.console.aws.amazon.com/s3/buckets/xxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx/cloudformation/xxxxxxx/xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles.yaml”
template_parameters: “{{ account_config.0.account_config.stacks[’ xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles’].params }}”
termination_protection: no
tags: “{{ global_tags | combine(account_config.0.account_config.stacks[’ xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles’].override_tags, recursive=True) }}”
loop: “{{ assumed_roles_with_account_config.results|subelements(‘account_config.regions’, skip_missing=True) }}”
loop_control:
loop_var: account_config
label: “{{ account_config.0.account_config.account_alias }}:{{ account_config.1 }}”
tags:
rxgt-ps-identity-stack-deploy -
name: create xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles stack
cloudformation:
stack_name: “xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles”
state: present
region: “{{ account_config.1 }}”
aws_access_key: “{{ account_config.0.sts_creds.access_key }}”
aws_secret_key: “{{ account_config.0.sts_creds.secret_key }}”
security_token: “{{ account_config.0.sts_creds.session_token }}”
create_changeset: false
changeset_name: “{{ cf_changeset_name }}”
template_url: “https://s3.console.aws.amazon.com/s3/buckets/xxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx/cloudformation/xxxxxxx/xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles.yaml”
template_parameters: “{{ account_config.0.account_config.stacks[‘xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles’].params }}”
termination_protection: no
tags: “{{ global_tags | combine(account_config.0.account_config.stacks[‘xx-xxxx-xxxx-xxxxxx-iam-atlas-developer-roles’].override_tags, recursive=True) }}”
Convert to a list of dicts duplicated per region. See https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#subelements-filter
loop: “{{ assumed_roles_with_account_config.results|subelements(‘account_config.regions’, skip_missing=True) }}”
loop_control:
loop_var: account_config
label: “{{ account_config.0.account_config.account_alias }}:{{ account_config.1 }}”
when: with_stack_deploy
tags:
rxgt-ps-identity-stack-deploy