Perhaps I'm not understanding what you're after, but this worked for me:
initial_token: {{ tokens[inventory_hostname] }}On Mon, Oct 6, 2014 at 1:06 PM, <[email protected]> wrote: > I am trying to come up with a play book to install cassandra. Here each > node has a calculated token (not a random hash) and is unique. So, I have > defined a dictionary in the vars/cassandra_variables.yml as below. The > IPs 192.168.56.x happen to be the ansible_inventory hosts which are defined > in the inventory file as [cassandrahosts] > How would I access the dictionary through jinja2 template.? > > > vars/cassandra_variables.yml > tokens: > 192.168.56.1: 0 > 192.168.56.2: 56713727820156410577229101238628035242 > 192.168.56.3: 113427455640312821154458202477256070485 > > > 192.168.56.x hosts are coming in from inventory file and in the > "cassandra.j2" I have the following > > initial_token: {{ tokens['{{ inventory_hostname}}'] }} > > tokens["{{ inventory_hostname}}"] is evaluated but not {{ tokens['{{ > inventory_hostname}}'] }} > > > How do I get it to work? Where am I going wrong? Any help is much > appreciated. > > > -SR > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/ee4a86cb-cc29-4345-82f0-5592ecc6ec8f%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/ee4a86cb-cc29-4345-82f0-5592ecc6ec8f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABnTgtUW4r%3DsEf1E8vbC1HfwvFsPm3%2B%2BPweLnctqR2q0ybhZOQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
