One solution could be to use a variable in the path for the template
source. The variable name could be a hostname or some other fact, or a
variable you set in groupvars.

For example, the files could be stored as:

templates/foo/test.tmpl
templates/bar/test.tmpl

Playbook:

  vars:
  - test1: foo
  - test2: bar
  tasks:
  - template: src=templates/{{test1}}/test.tmpl dest=/tmp/foo.out
  - template: src=templates/{{test2}}/test.tmpl dest=/tmp/bar.out



On Sat, Jan 18, 2014 at 8:25 AM, Mathew Davies <
[email protected]> wrote:

> Hi,
>
> I'm finding myself running into a problem of where to store Apache / Nginx
> vhosts. I originally planned to abstract the template to a point I could
> customise it with variables, but that proved a waste of time because
> they're so different from one another.
>
> What's the best way to go about this problem?
>
> I'm undecided if it's a good idea to store them in a roles "files/"
> directory and just copy over the ones I need or do something more advanced.
>
> Any real world uses cases would be appreciated.
>
> Kind Regards,
> -Mathew Davies.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 

James Cammarata <[email protected]>
Sr. Software Engineer, 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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to