2017-11-20 22:11:38 +08:00
|
|
|
---
|
|
|
|
- name: check firewalld installation on redhat or suse
|
|
|
|
command: rpm -q firewalld
|
|
|
|
args:
|
|
|
|
warn: no
|
|
|
|
register: firewalld_pkg_query
|
|
|
|
ignore_errors: true
|
|
|
|
check_mode: no
|
|
|
|
changed_when: false
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2019-04-01 23:46:15 +08:00
|
|
|
- when: (firewalld_pkg_query.get('rc', 1) == 0
|
2019-05-22 16:02:42 +08:00
|
|
|
or is_atomic | bool)
|
2019-03-28 16:13:30 +08:00
|
|
|
block:
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: start firewalld
|
|
|
|
service:
|
|
|
|
name: firewalld
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2018-06-16 03:53:47 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open monitor and manager ports
|
|
|
|
firewalld:
|
|
|
|
service: "{{ item.service }}"
|
|
|
|
zone: "{{ item.zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
with_items:
|
|
|
|
- { 'service': 'ceph-mon', 'zone': "{{ ceph_mon_firewall_zone }}" }
|
|
|
|
- { 'service': 'ceph', 'zone': "{{ ceph_mgr_firewall_zone }}" }
|
|
|
|
when:
|
|
|
|
- mon_group_name is defined
|
|
|
|
- mon_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2018-06-04 10:40:14 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open manager ports
|
|
|
|
firewalld:
|
|
|
|
service: ceph
|
|
|
|
zone: "{{ ceph_mgr_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- mgr_group_name is defined
|
|
|
|
- mgr_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open osd ports
|
|
|
|
firewalld:
|
|
|
|
service: ceph
|
|
|
|
zone: "{{ ceph_osd_firewall_zone }}"
|
|
|
|
source: "{{ item }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
with_items:
|
|
|
|
- "{{ public_network }}"
|
|
|
|
- "{{ cluster_network }}"
|
|
|
|
when:
|
|
|
|
- osd_group_name is defined
|
|
|
|
- osd_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open rgw ports
|
|
|
|
firewalld:
|
|
|
|
port: "{{ radosgw_frontend_port }}/tcp"
|
|
|
|
zone: "{{ ceph_rgw_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- rgw_group_name is defined
|
|
|
|
- rgw_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open mds ports
|
|
|
|
firewalld:
|
|
|
|
service: ceph
|
|
|
|
zone: "{{ ceph_mds_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- mds_group_name is defined
|
|
|
|
- mds_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open nfs ports
|
|
|
|
firewalld:
|
|
|
|
service: nfs
|
|
|
|
zone: "{{ ceph_nfs_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- nfs_group_name is defined
|
|
|
|
- nfs_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open nfs ports (portmapper)
|
|
|
|
firewalld:
|
|
|
|
port: "111/tcp"
|
|
|
|
zone: "{{ ceph_nfs_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- nfs_group_name is defined
|
|
|
|
- nfs_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open rbdmirror ports
|
|
|
|
firewalld:
|
|
|
|
service: ceph
|
|
|
|
zone: "{{ ceph_rbdmirror_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- rbdmirror_group_name is defined
|
|
|
|
- rbdmirror_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2017-11-20 22:11:38 +08:00
|
|
|
|
2018-12-01 00:12:21 +08:00
|
|
|
- name: open iscsi target ports
|
|
|
|
firewalld:
|
|
|
|
port: "3260/tcp"
|
|
|
|
zone: "{{ ceph_iscsi_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- iscsi_gw_group_name is defined
|
|
|
|
- iscsi_gw_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2018-12-01 00:12:21 +08:00
|
|
|
|
|
|
|
- name: open iscsi api ports
|
|
|
|
firewalld:
|
|
|
|
port: "{{ api_port | default(5000) }}/tcp"
|
|
|
|
zone: "{{ ceph_iscsi_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- iscsi_gw_group_name is defined
|
|
|
|
- iscsi_gw_group_name in group_names
|
2019-04-01 23:46:15 +08:00
|
|
|
tags: firewall
|
2018-10-31 03:03:37 +08:00
|
|
|
|
2019-08-27 17:25:02 +08:00
|
|
|
- name: open iscsi/prometheus port
|
|
|
|
firewalld:
|
|
|
|
port: "9287/tcp"
|
|
|
|
zone: "{{ ceph_iscsi_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- iscsi_gw_group_name is defined
|
|
|
|
- iscsi_gw_group_name in group_names
|
|
|
|
tags: firewall
|
|
|
|
|
2019-05-22 22:31:21 +08:00
|
|
|
- name: open node_exporter port
|
|
|
|
firewalld:
|
2019-07-11 05:15:45 +08:00
|
|
|
port: "{{ node_exporter_port }}/tcp"
|
2019-05-22 22:31:21 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when: dashboard_enabled | bool
|
|
|
|
|
2018-12-06 02:59:47 +08:00
|
|
|
- block:
|
2019-05-22 22:31:21 +08:00
|
|
|
- name: open dashboard port
|
2018-12-06 02:59:47 +08:00
|
|
|
firewalld:
|
2019-05-22 22:31:21 +08:00
|
|
|
port: "{{ dashboard_port }}/tcp"
|
2018-12-06 02:59:47 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
|
2019-05-22 22:31:21 +08:00
|
|
|
- name: open mgr/prometheus port
|
2018-12-06 02:59:47 +08:00
|
|
|
firewalld:
|
2019-05-22 22:31:21 +08:00
|
|
|
port: "9283/tcp"
|
2018-12-06 02:59:47 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
2019-05-22 22:31:21 +08:00
|
|
|
when:
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
- mgr_group_name is defined
|
|
|
|
- mgr_group_name in group_names
|
2018-12-06 02:59:47 +08:00
|
|
|
|
2019-05-22 22:31:21 +08:00
|
|
|
- block:
|
|
|
|
- name: open grafana port
|
2018-12-06 02:59:47 +08:00
|
|
|
firewalld:
|
2019-07-11 05:15:45 +08:00
|
|
|
port: "{{ grafana_port }}/tcp"
|
2018-12-06 02:59:47 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
|
2019-07-11 05:19:29 +08:00
|
|
|
- name: open prometheus port
|
2018-12-06 02:59:47 +08:00
|
|
|
firewalld:
|
2019-07-11 05:15:45 +08:00
|
|
|
port: "{{ prometheus_port }}/tcp"
|
2018-12-06 02:59:47 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
2019-05-22 22:31:21 +08:00
|
|
|
|
|
|
|
- name: open alertmanager port
|
|
|
|
firewalld:
|
2019-07-11 05:15:45 +08:00
|
|
|
port: "{{ alertmanager_port }}/tcp"
|
2019-05-22 22:31:21 +08:00
|
|
|
zone: "{{ ceph_dashboard_firewall_zone }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
- inventory_hostname in groups.get('grafana-server', [])
|
2018-12-06 02:59:47 +08:00
|
|
|
|
2019-04-04 10:54:41 +08:00
|
|
|
- name: open haproxy ports
|
|
|
|
firewalld:
|
|
|
|
port: "{{ haproxy_frontend_port | default(80) }}/tcp"
|
|
|
|
zone: "{{ ceph_rgwloadbalancer_firewall_zone }}"
|
|
|
|
source: "{{ public_network }}"
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- rgwloadbalancer_group_name is defined
|
|
|
|
- rgwloadbalancer_group_name in group_names
|
|
|
|
tags:
|
|
|
|
- firewall
|
|
|
|
|
|
|
|
- name: add rich rule for keepalived vrrp
|
|
|
|
firewalld:
|
|
|
|
rich_rule: 'rule protocol value="vrrp" accept'
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
state: enabled
|
|
|
|
when:
|
|
|
|
- rgwloadbalancer_group_name is defined
|
|
|
|
- rgwloadbalancer_group_name in group_names
|
|
|
|
tags:
|
|
|
|
- firewall
|
|
|
|
|
2017-11-20 22:11:38 +08:00
|
|
|
- meta: flush_handlers
|