Hi, I want to do this code in ansible: foreach($host in $group) { foreach($var in $host.hostvars) { echo $var.key echo $var.value } }
The playbook should iterate over all hosts in a specific group. Then it should use a specific variable in hostvars as a list and for every item it should execute a task. This one is my inventory: # GROUPS #GLOBAL [k8:children] k8_master k8_worker [k8_master] vsrvk8c01 k8_label = [ role=master ] vsrvk8c02 k8_label = [ role=master ] [k8_worker] vsrvk8w01 k8_label = [ role=worker, loc=1, tier=0 ] vsrvk8w02 k8_label = [ role=worker, tier=1, location=US ] vsrvk8w03 k8_label = [ role=worker, cap=af ] I want to label each Kubernetes Node with the correct labels. How can I archive this? Unfortunately, I don't know the correct approach. -- 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/d1fed9ea-25e6-4f38-bfbb-3f06b078f0ed%40googlegroups.com.