Use Ansible variable in AWS Cloudformation template

$ ansible-playbook -e variable=value

Sorry I think you may have misunderstood what I am trying to accomplish.

I need to pass an ansible variable to a cloudformation template yml file.

I believe I need to do some form of templating with j2, but looking for pointers.

Thanks

You can let ansible generate the cloud formation template and then it will work

Can you expand on that please Sir?

You can use ansible to generate the cloudformation template, so you can use any variables from your ansible inventory/vars/etc.
For instance using a ‘template’ task.
Then once that is done, the result can by used by cloudformation.

I have no idea how this may (or may not) fit into whatever work flow you have.