Add group variables to the prereq role (#334)

Signed-off-by: laszlojau <49835454+laszlojau@users.noreply.github.com>
This commit is contained in:
laszlojau
2024-06-11 02:28:06 +09:30
committed by GitHub
parent 5a12415b3c
commit 1907e6fb79
2 changed files with 6 additions and 4 deletions

View File

@@ -1,2 +1,4 @@
--- ---
api_port: 6443 # noqa var-naming[no-role-prefix] api_port: 6443 # noqa var-naming[no-role-prefix]
server_group: server # noqa var-naming[no-role-prefix]
agent_group: agent # noqa var-naming[no-role-prefix]

View File

@@ -51,7 +51,7 @@
- name: If ufw enabled, open etcd ports - name: If ufw enabled, open etcd ports
when: when:
- ufw_status['stdout'] == "Status':' active" - ufw_status['stdout'] == "Status':' active"
- groups['server'] | length > 1 - groups[server_group] | length > 1
community.general.ufw: community.general.ufw:
rule: allow rule: allow
port: "2379:2381" port: "2379:2381"
@@ -79,7 +79,7 @@
immediate: true immediate: true
- name: If firewalld enabled, open etcd ports - name: If firewalld enabled, open etcd ports
when: groups['server'] | length > 1 when: groups[server_group] | length > 1
ansible.posix.firewalld: ansible.posix.firewalld:
port: "2379-2381/tcp" port: "2379-2381/tcp"
zone: internal zone: internal
@@ -111,8 +111,8 @@
loop: >- loop: >-
{{ {{
( (
groups['server'] | default([]) groups[server_group] | default([])
+ groups['agent'] | default([]) + groups[agent_group] | default([])
) )
| map('extract', hostvars, ['ansible_default_ipv4', 'address']) | map('extract', hostvars, ['ansible_default_ipv4', 'address'])
| flatten | unique | list | flatten | unique | list