Discussion:
Remote template
Bruno Dupuis
2013-09-30 10:29:06 UTC
Permalink
Hi,

Is there a practical way to use a remote file as a jinja template in
template modules ?

Let's explain my use case:

My application code requires configuration that may vary depending on the
environment (dev/staging/prot)

I want to keep configuration defintion into application code, as j2
template, because it's easier to maintain.

Those templates are deployed on the target machines along with the app, and
then ansible creates final configuration files, using host/group variables.

Regards.

--
Brian Harring
2013-09-30 18:37:43 UTC
Permalink
Post by Bruno Dupuis
Hi,
Is there a practical way to use a remote file as a jinja template in
template modules ?
Combination of the fetch module and template module seems to be your
options here. Specifically
http://www.ansibleworks.com/docs/modules.html#fetch .
Post by Bruno Dupuis
My application code requires configuration that may vary depending on the
environment (dev/staging/prot)
I want to keep configuration defintion into application code, as j2
template, because it's easier to maintain.
Those templates are deployed on the target machines along with the app,
and then ansible creates final configuration files, using host/group
variables.
Fun pattern; I'd be curious what your final implementation is for this. My
first inclination is that of "just centralize it in the repo- say via git
submodules", but that has it's own issues.

Cheers-
~brian
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Michael DeHaan
2013-09-30 19:35:11 UTC
Permalink
+1 to submodules, this way your playbook repo would have access to the
template and those hijinks would not be required.
Post by Brian Harring
Post by Bruno Dupuis
Hi,
Is there a practical way to use a remote file as a jinja template in
template modules ?
Combination of the fetch module and template module seems to be your
options here. Specifically
http://www.ansibleworks.com/docs/modules.html#fetch .
Post by Bruno Dupuis
My application code requires configuration that may vary depending on the
environment (dev/staging/prot)
I want to keep configuration defintion into application code, as j2
template, because it's easier to maintain.
Those templates are deployed on the target machines along with the app,
and then ansible creates final configuration files, using host/group
variables.
Fun pattern; I'd be curious what your final implementation is for this.
My first inclination is that of "just centralize it in the repo- say via
git submodules", but that has it's own issues.
Cheers-
~brian
--
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
For more options, visit https://groups.google.com/groups/opt_out.
--
Michael DeHaan <***@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
vitaly bichov
2015-07-23 07:17:23 UTC
Permalink
Hi,

I'm facing the same issue and wonder how you solved it?
Post by Bruno Dupuis
Hi,
Is there a practical way to use a remote file as a jinja template in
template modules ?
My application code requires configuration that may vary depending on the
environment (dev/staging/prot)
I want to keep configuration defintion into application code, as j2
template, because it's easier to maintain.
Those templates are deployed on the target machines along with the app,
and then ansible creates final configuration files, using host/group
variables.
Regards.
--
Bruno
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a7a24228-78b0-4482-91e9-57b76fc1cdfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-23 12:17:28 UTC
Permalink
something like?

template: src={{lookup('uri', 'http://remote.com/file.j2'}}
Post by vitaly bichov
Hi,
I'm facing the same issue and wonder how you solved it?
Post by Bruno Dupuis
Hi,
Is there a practical way to use a remote file as a jinja template in
template modules ?
My application code requires configuration that may vary depending on the
environment (dev/staging/prot)
I want to keep configuration defintion into application code, as j2
template, because it's easier to maintain.
Those templates are deployed on the target machines along with the app,
and then ansible creates final configuration files, using host/group
variables.
Regards.
--
Bruno
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a7a24228-78b0-4482-91e9-57b76fc1cdfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8kXjbvnpxkBZ5r7P%2BJDT%2B96%2BVFbg%3DokfwJY_Ow%3DRXA9KA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...