On 19.01.17 19:43 Kai Stian Olstad wrote:

>> The foo playbook has templatized config files ... and there's the
>> rub. I want the foo playbook to work on s8 and s9, BUT, I want
>> different strings to be substituted when the template gets
>> processed, depending on whether I am on s8 or s9.

Kai already mentioned host_vars. If you rather want to do stuff in the
template, then do something like this:

- template:
    src: "foobar"
    dest: "/some/path"
  when: 'inventory_hostname == "s8" or inventory_hostname == "s9"'

In the template:

########### snip #############

{% if inventory_hostname == "s8" %}
Here is stuff for s8.
{% elif inventory_hostname == "s9" %}
Here is stuff for s9.
{% endif %}

########### snip #############

Johannes

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6ade1e63-426d-4b0d-e770-66da8835b2e9%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to