I have this inventory file inventory/hosts_elk Now I have a template, and I want to do this elk_server.yml.j2 But that doesn't work, that is the value for {{ elk-client-0 }} does NOT get substituted. What is the correct syntax so when the template gets laid out on the server, the resulting file looks like |
elk_server = {{ groups['elk-client-0'][0] }}--
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+unsubscribe@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/06b4ebff-9b5a-42c7-8618-214fb70f78b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Those aren't variables.You defined a group called 'elk-client-0' with a nameless server in it.This template will produce the output you want:elk_server = {{ groups['elk-client-0'][0] }}Though I'm a bit confused why you have an elk server in a group called 'elk-client-0'.
On 21 April 2017 at 18:13, ZillaYT <zil...@gmail.com> wrote:
I have this inventory file
inventory/hosts_elk
[elk-client-0] 10.11.22.22Now I have a template, and I want to do this
elk_server.yml.j2
elk_server = {{ elk-client-0 }}But that doesn't work, that is the value for {{ elk-client-0 }} does NOT get substituted.
What is the correct syntax so when the template gets laid out on the server, the resulting file looks like
elk_server = 10.11.22.22
--
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 post to this group, send email to ansible...@googlegroups.com.