My first thought is how do you have your inventory in tower? Does it match
the same exact layout as your inventory on the command line?

As in server1 is the first entry, server2 the second, etc..?

But generally speaking, since inventories may not always be perfectly
matched, a better solution would be to do some python/jinja2 logic in your
Template to scan the inventory provided and generate the server properties.

On Thu, Nov 21, 2019 at 07:36 madhan dhanikachalam <madhan0...@gmail.com>
wrote:

> i have a code like this
>
>     - template:
>         src: ../files/kfhost.j2
>         dest: /app/bin/kafka/server.properties
>         owner: kafka
>         group: kafka
>         mode: 0755
>
> the jinga file has an entry like this
>
> broker.id={{ play_hosts.index(inventory_hostname)+1 }}
>
> when i have an inventory file like this
>
> [all]
> server1
> server2
> server3
>
> and run this playbook from command line. server1 broker.id is set to 1,
> server2 broker.id is set to 2 and server3 broker.id is set to 3.
>
> when i run the same in ansbile tower, sometimes the server1 gets value 2,
> server2 gets value 1
>
> the order is getting mismatched.
>
> just fyi there are other tasks before this task in the playbook
>
> any idea as to why this might be happening in tower and never when i run
> ansible-playbook command line
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/4b271314-1da7-4750-828e-42d4876d33aa%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-devel/4b271314-1da7-4750-828e-42d4876d33aa%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CA%2Bs1_jRGYNMW3qsLc01eQRMbxdzRPw-jq9oy%2BvPkLzpbEqKa2Q%40mail.gmail.com.

Reply via email to