Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jessie support #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ ansible-firewall
================

Ansible Role for Firewall & Persistence


* Add compatibility Debian Wheezy/Jessie
1,689 changes: 1,678 additions & 11 deletions files/rules.v4

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---
- name: Start Iptables Persistent
service: name=iptables-persistent state=started
when: ansible_distribution_release == 'wheezy'

- name: Restart Iptables Persistent
service: name=iptables-persistent state=restarted
when: ansible_distribution_release == 'wheezy'

- name: Start Netfilter Persistent
service: name=netfilter-persistent state=started
when: ansible_distribution_release == 'jessie'

- name: Restart Netfilter Persistent
service: name=netfilter-persistent state=restarted
when: ansible_distribution_release == 'jessie'

- name: Testing rules only
shell: /sbin/iptables-restore -t < /etc/iptables/rules.v4
12 changes: 12 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install Iptables Persistent
apt: pkg=iptables-persistent state=installed update_cache=true
notify:
- Start Iptables Persistent
when: ansible_distribution_release == 'wheezy'

- name: Install Netfilter Persistent
apt: pkg=netfilter-persistent state=installed update_cache=true
notify:
- Start Netfilter Persistent
when: ansible_distribution_release == 'jessie'
20 changes: 14 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
---
- name: Install Iptables Persistent
apt: pkg=iptables-persistent state=installed update_cache=true
notify:
- Start Iptables Persistent
- name: install
include: install.yml
#when: manage is not defined

- name: Set Firewall Rules
copy: src={{ iptables_file }} dest=/etc/iptables/rules.v4 owner=root group=root mode=644
notify:
- Restart Iptables Persistent
- Restart Netfilter Persistent
#when: manage is not defined

- name: copy Firewall Rules
copy: src={{ iptables_file }} dest=/etc/iptables/rules.v4 owner=root group=root mode=644
notify:
- Testing rules only
when: manage is defined

- name: Ensure Iptables Persistent Restarted
service: name=iptables-persistent state=restarted
- name: manage
include: manage.yml
when: manage is defined
9 changes: 9 additions & 0 deletions tasks/manage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
#- include: install.yml

#- name: Testing files
# shell: /sbin/iptables-restore -t < /etc/iptables/rules.v4
# register: toto

#- name: print var
# debug: msg="{{ toto }}"