better handling of ports

This commit is contained in:
Sebastien Perreault 2019-02-01 11:11:57 -05:00 committed by Barry van Someren
parent 22c48ea86b
commit 2f1b84b98e

View File

@ -17,29 +17,41 @@
when: cockpit_disable_tls
- name: change default listen port
block:
- ini_file:
blockinfile:
dest: "/etc/systemd/system/cockpit.socket.d/listen.conf"
create: true
section: "Socket"
value: |
backup: true
owner: root
group: root
mode: 0755
state: present
block: |
[Socket]
ListenStream=
ListenStream={{ cockpit_listen_port }}
when: cockpit_listen_port is not "9090"
when: cockpit_listen_port != "9090"
- name: do selinux change if required
block:
- package:
- name: install package
package:
name: policycoreutils-python
state: present
- seport:
- name: enable seport
seport:
ports: "{{ cockpit_listen_port }}"
proto: tcp
setype: websm_port_t
state: present
when: cockpit_listen_port is not "9090" and cockpit_use_selinux
when: cockpit_listen_port != "9090" and cockpit_use_selinux
- name: enable firewall
block:
- name: install firewalld bindings
package:
name: python-firewall
state: latest
- name: enable firewalld
firewalld:
port: "{{ cockpit_listen_port }}/tcp"
permanent: true