ansible-role-cloudformation
ansible-role-cloudformation copied to clipboard
Host specific template name
When using this role to apply templates to multiple AWS accounts, I often need slightly different results from the rendering per account. An example would be when the template will include the account's ID - that value must differ between the 'hosts' (accounts). The fix is trivial:
$ git diff tasks/
diff --git a/tasks/run.yml b/tasks/run.yml
index 28ea31c..cf38a20 100644
--- a/tasks/run.yml
+++ b/tasks/run.yml
@@ -5,7 +5,7 @@
###
- name: register a sane template name
set_fact:
- cloudformation_file_name: "{{ cloudformation.template | basename }}-{{ cloudformation.stack_name }}.yml"
+ cloudformation_file_name: "{{ inventory_hostname + '-' + cloudformation.template | basename }}-{{ cloudformation.stack_name }}.yml"
check_mode: False
.. we just include the inventory_hostname
in the rendered template path. Worth considering?