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