Skip to content

Commit

Permalink
Add group variables to the prereq role (k3s-io#334)
Browse files Browse the repository at this point in the history
Signed-off-by: laszlojau <[email protected]>
  • Loading branch information
laszlojau authored and steevi committed Jul 2, 2024
1 parent 4d36f49 commit f0b1388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions roles/prereq/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
---
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]
8 changes: 4 additions & 4 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
- name: If ufw enabled, open etcd ports
when:
- ufw_status['stdout'] == "Status':' active"
- groups['server'] | length > 1
- groups[server_group] | length > 1
community.general.ufw:
rule: allow
port: "2379:2381"
Expand Down Expand Up @@ -82,7 +82,7 @@
immediate: true

- name: If firewalld enabled, open etcd ports
when: groups['server'] | length > 1
when: groups[server_group] | length > 1
ansible.posix.firewalld:
port: "2379-2381/tcp"
zone: internal
Expand Down Expand Up @@ -114,8 +114,8 @@
loop: >-
{{
(
groups['server'] | default([])
+ groups['agent'] | default([])
groups[server_group] | default([])
+ groups[agent_group] | default([])
)
| map('extract', hostvars, ['ansible_default_ipv4', 'address'])
| flatten | unique | list
Expand Down

0 comments on commit f0b1388

Please sign in to comment.