debops / ansible-ferm

Manage iptables firewall using ferm
GNU General Public License v3.0
32 stars 20 forks source link

debconf task prevents use of ansible-ferm on non debian distributions #104

Closed janondrusek closed 6 years ago

janondrusek commented 7 years ago
- name: Configure ferm status in debconf
  debconf:
    name: 'ferm'
    question: 'ferm/enable'
    vtype: 'boolean'
    value: '{{ "yes" if ferm__enabled|bool else "no" }}'

has no option to be skipped, except for entirely disabling the role. I am using debops on CentOS and direct use of debconf would require a custom fork.

Would it be possible to add a skip option for it?

Thanks

drybjed commented 7 years ago

I'm impressed that you don't have other issues before this role in the common playbook, unless you use the role directly. Yes, I suppose that a when: ansible_distribution in [ 'Debian', 'Ubuntu' ] for this task should suffice. I'll add this in my rewrite PR. NB, would you like to test the new changes on CentOS to see if any other issues show up?

janondrusek commented 7 years ago

Yes, that worked:

diff --git a/tasks/main.yml b/tasks/main.yml
index 561f072..d5bd27a 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -6,6 +6,7 @@
     question: 'ferm/enable'
     vtype: 'boolean'
     value: '{{ "yes" if ferm__enabled|bool else "no" }}'
+  when: ansible_distribution in [ 'Debian', 'Ubuntu' ]

 - name: Ensure ferm is installed
   package:

Usually the only blockers are apt related tasks, that do not have an optional when clause. E.g. https://github.com/debops/ansible-bootstrap/issues/40