Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently using Puppet's new firewall module. I am trying to have Puppet flush iptables before it applies firewall rules. I tried the following:

exec { 'clear-firewall':
        command => '/sbin/iptables -F',
        refreshonly => true,

Firewall {
        subscribe => Exec['clear-firewall'],
        notify => Exec['persist-firewall'],

So far, it has not worked. Can anyone suggest or know of another method I should try?

share|improve this question
up vote 2 down vote accepted

So I imagine you are in one of two situations:

  1. You have existing rules you wish to flush because you want the puppet configuration to own your firewall rules
  2. You have existing rules that are not compatible with the firewall provider

If its 1 ... just try turning on purge somewhere in top scope:

resources { "firewall":
  purge => true,

If its 2 ... you will probably need to purge those rules or make them compatible before puppet runs. If you have a particular incompatibility let me know - we should probably get a bug raised on it.

share|improve this answer
Situation 1. And thank you! I will test it this evening. Did not see that in the documentation (puppet describe firewall). – Belmin Fernandez Nov 28 '11 at 15:55
In my manifests, I have that in site.pp but Puppet is still not purging the firewall rules. – Rob Jan 24 '14 at 14:50
@Rob sounds like a bug. – Ken Barber Jan 27 '14 at 20:16
@KenBarber I think it is. – Rob Jan 30 '14 at 15:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.