summaryrefslogtreecommitdiffstats
path: root/roles/lib_os_firewall/README.md
blob: ba8c84865c2accaa9fea3378d2ce12836efbb567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
lib_os_firewall
===========

lib_os_firewall manages iptables firewall settings for a minimal use
case (Adding/Removing rules based on protocol and port number).

Note: firewalld is not supported on Atomic Host
https://bugzilla.redhat.com/show_bug.cgi?id=1403331

Requirements
------------

Ansible 2.2

Role Variables
--------------

| Name                      | Default |                                        |
|---------------------------|---------|----------------------------------------|
| os_firewall_allow         | []      | List of service,port mappings to allow |
| os_firewall_deny          | []      | List of service, port mappings to deny |

Dependencies
------------

None.

Example Playbook
----------------

Use iptables and open tcp ports 80 and 443:
```
---
- hosts: servers
  vars:
    os_firewall_use_firewalld: false
    os_firewall_allow:
    - service: httpd
      port: 80/tcp
    - service: https
      port: 443/tcp
  tasks:
  - include_role:
      name: lib_os_firewall

  - name: set allow rules
    os_firewall_manage_iptables:
      name: "{{ item.service }}"
      action: add
      protocol: "{{ item.port.split('/')[1] }}"
      port: "{{ item.port.split('/')[0] }}"
    with_items: "{{ os_firewall_allow }}"
```


License
-------

Apache License, Version 2.0

Author Information
------------------
Jason DeTiberus - jdetiber@redhat.com