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. On Wed, 13 Oct 2021 at 16:29, 'Tony' via Ansible Project < ansible-project@googlegroups.com> wrote: > Can you expand on that please Sir? > > On Tuesday, 12 October 2021 at 15:26:37 UTC+1 dick....@geant.org wrote: > >> You can let ansible generate the cloud formation template and then it >> will work >> >> On Tue, 12 Oct 2021 at 14:51, 'Tony' via Ansible Project < >> ansible...@googlegroups.com> wrote: >> >>> 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 >>> >>> On Tuesday, 12 October 2021 at 13:13:36 UTC+1 mikee...@gmail.com wrote: >>> >>>> $ ansible-playbook -e variable=value >>>> >>>> On Oct 12, 2021, at 04:56, 'Tony' via Ansible Project < >>>> ansible...@googlegroups.com> wrote: >>>> >>>> Hi, >>>> >>>> I am trying to use an ansible variable in my AWS cloudformation >>>> template, see below red where I am trying to use the variable from Ansible. >>>> >>>> Parameters: >>>> >>>> Environment: >>>> Description: 'Environment definition.' >>>> Type: 'String' >>>> Default: 'Dev' >>>> >>>> Resources: >>>> >>>> VPC: >>>> Type: 'AWS::EC2::VPC' >>>> Properties: >>>> CidrBlock: >>>> "{{ ansible variable here }}" >>>> EnableDnsSupport: true >>>> EnableDnsHostnames: true >>>> InstanceTenancy: 'default' >>>> Tags: >>>> - Key: 'Environment' >>>> Value: >>>> Ref: 'Environment' >>>> >>>> Does anyone know how to pass this on to Ansible? >>>> >>>> Thank you! >>>> >>>> -- >>>> 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/faae7897-90bd-41c0-9966-a5e459e80686n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/ansible-project/faae7897-90bd-41c0-9966-a5e459e80686n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> >>>> -- >>> 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/c8d739f2-ec71-448b-8def-766fc357405en%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/c8d739f2-ec71-448b-8def-766fc357405en%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Dick Visser >> Trust & Identity Service Operations Manager >> GÉANT >> > -- > 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-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2af1bb00-4a19-4755-bacf-52f98e048ed5n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/2af1bb00-4a19-4755-bacf-52f98e048ed5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwPR8m_TjRBx-A93FmsRZxtkWwwUdqiBrN-8Bf6fBD3t7A%40mail.gmail.com.