Skip to content

Commit fd8bea6

Browse files
committed
LogDenial and Selinux
1 parent 602ea78 commit fd8bea6

File tree

1 file changed

+20
-0
lines changed
  • ansible/playbooks/roles/sap_hana_install/tasks/post_install

1 file changed

+20
-0
lines changed

ansible/playbooks/roles/sap_hana_install/tasks/post_install/firewall.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
enabled: yes
88
tags: sap_hana_install_configure_firewall
99

10+
- name: SAP HANA Post Install - Set LogDenied to all in firewalld.conf
11+
ansible.builtin.lineinfile:
12+
path: /etc/firewalld/firewalld.conf
13+
regexp: '^LogDenied=off'
14+
line: 'LogDenied=all'
15+
tags: sap_hana_install_configure_firewall
16+
1017
- name: SAP HANA Post Install - Construct the argument list for 'firewall-cmd --add-port'
1118
ansible.builtin.set_fact:
1219
__sap_hana_install_fact_firewall_cmd_args:
@@ -69,3 +76,16 @@
6976
ansible.builtin.debug:
7077
var: __sap_hana_install_register_permanent_firewall_ports.stdout_lines
7178
tags: sap_hana_install_configure_firewall
79+
80+
- name: SAP HANA Post Install - Add SELinux port labels
81+
# Note: The 'semanage port' command uses a dash '-' to define port ranges,
82+
# e.g., 'semanage port -a -t sap_port_t -p tcp 30000-30010'
83+
ansible.builtin.command: "semanage port -a -t sap_port_t -p {{ item.split('/')[1] }} {{ item.split('/')[0] }}"
84+
loop: "{{ sap_hana_install_firewall[0].port }}"
85+
when: sap_hana_install_firewall[0].state == 'enabled'
86+
register: __sap_hana_install_register_semanage_ports
87+
changed_when: __sap_hana_install_register_semanage_ports.rc == 0
88+
failed_when:
89+
- __sap_hana_install_register_semanage_ports.rc != 0
90+
- "'Port is already defined' not in __sap_hana_install_register_semanage_ports.stderr"
91+
tags: sap_hana_install_configure_firewall

0 commit comments

Comments
 (0)