Ansible RKE2: loop group servers on template configs

This commit is contained in:
Purname Yasa 2024-11-16 05:23:31 +08:00
parent 9b130ebc96
commit 012fa317bc
2 changed files with 6 additions and 6 deletions

View file

@ -3,8 +3,8 @@ token: {{ hostvars['server1']['token'] }}
server: https://{{ hostvars['server1']['ansible_host'] }}:9345
tls-san:
- {{ vip }}
- {{ hostvars['server1']['ansible_host'] }}
- {{ hostvars['server2']['ansible_host'] }}
- {{ hostvars['server3']['ansible_host'] }}
{% for host in groups['servers'] %}
- {{ hostvars[host]['ansible_host'] }}
{% endfor %}
node-label:
- server=true

View file

@ -1,9 +1,9 @@
write-kubeconfig-mode: "0644"
tls-san:
- {{ vip }}
- {{ hostvars['server1']['ansible_host'] }}
- {{ hostvars['server2']['ansible_host'] }}
- {{ hostvars['server3']['ansible_host'] }}
{% for host in groups['servers'] %}
- {{ hostvars[host]['ansible_host'] }}
{% endfor %}
node-label:
- server=true
disable: