Answer the question
In order to leave comments, you need to log in
How to read variables in ansible by separate group?
Good afternoon!
There is an inventory file.
cluster:
children:
masters:
hosts:
K8s-Master01:
ansible_host: 192.168.0.2
workers:
hosts:
K8s-Node01:
ansible_host: 192.168.0.3
K8s-Node02:
ansible_host: 192.168.0.4
taints:
- dedicated=true:NoSchedule
- name: Apply taints
shell: "kubectl taint nodes {{ item | lower }} {{ hostvars['{{ item }}']['taints'] }}"
with_items: "{{ groups.workers }}"
Answer the question
In order to leave comments, you need to log in
As far as I remember, through groups['workers'] you can get to the hosts. well, that one is already extractors of deeper-- data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question