Skip to content

Commit cec6bbe

Browse files
committed
refactor: use firewall role instead of module
We already have the firewall role in the system roles collection. Use that instead of the firewalld module which adds an extra dependency. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent b6ca649 commit cec6bbe

4 files changed

Lines changed: 20 additions & 23 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Type: `bool`
5353
### trustee_server_secret_registration_listen_port
5454

5555
TCP port on which the secret registration server listens. The role opens this
56-
port in firewalld when `firewalld` is running.
56+
port in firewalld.
5757

5858
Default: `8081`
5959

@@ -94,7 +94,7 @@ More examples are in the [`examples/`](examples) directory.
9494

9595
When enabled, the role:
9696

97-
1. Downloads the Podman Quadlets from designated repo
97+
1. Installs the Podman Quadlets provided by the role
9898
2. Generates all required certificates of Trustee server components
9999
3. Add KBS port 8080 to firewalld
100100
4. Enables the services by default

meta/collection-requirements.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
---
33
collections:
44
- name: ansible.posix
5+
- name: fedora.linux_system_roles

tasks/secret_registration_server.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,18 @@
2727
register: __trustee_server_secret_reg_service
2828
notify: "restart trustee services"
2929

30-
- name: Gather service facts for firewall check
31-
ansible.builtin.service_facts:
32-
no_log: "{{ ansible_verbosity < 3 }}"
33-
3430
- name: Allow secret registration server port in firewall
35-
ansible.posix.firewalld:
36-
port: "{{ trustee_server_secret_registration_listen_port }}/tcp"
37-
permanent: true
38-
immediate: true
39-
state: enabled
40-
when: (ansible_facts.services | default({})).get('firewalld.service', {}).get('state', '') == 'running'
31+
ansible.builtin.include_role:
32+
name: fedora.linux_system_roles.firewall
33+
vars:
34+
firewall:
35+
- port: "{{ trustee_server_secret_registration_listen_port }}/tcp"
36+
permanent: true
37+
runtime: true
38+
state: enabled
4139

4240
- name: Append secret registration server service to the list of services to restart
4341
set_fact:
4442
__trustee_server_services: >-
4543
{{ (__trustee_server_services | default([])) + ['secret_registration_server'] }}
46-
when: "'secret_registration_server' not in __trustee_server_services"
44+
when: "'secret_registration_server' not in __trustee_server_services"

tasks/trustee_quadlet.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@
6262
changed_when: true
6363
no_log: "{{ trustee_server_secure_logging }}"
6464

65-
- name: Gather service facts
66-
ansible.builtin.service_facts:
67-
no_log: "{{ ansible_verbosity < 3 }}"
68-
6965
- name: Allow port 8080 in firewall
70-
ansible.posix.firewalld:
71-
port: "8080/tcp"
72-
permanent: true
73-
immediate: true
74-
state: enabled
75-
when: (ansible_facts.services | default({})).get('firewalld.service', {}).get('state', '') == 'running'
66+
ansible.builtin.include_role:
67+
name: fedora.linux_system_roles.firewall
68+
vars:
69+
firewall:
70+
- port: "8080/tcp"
71+
permanent: true
72+
runtime: true
73+
state: enabled
7674

7775
- name: Get the installed Trustee Server pod name
7876
ansible.builtin.find:

0 commit comments

Comments
 (0)