Skip to content

Instantly share code, notes, and snippets.

@centrix
Created December 6, 2012 18:01
Show Gist options
  • Save centrix/4226584 to your computer and use it in GitHub Desktop.
Save centrix/4226584 to your computer and use it in GitHub Desktop.
iptables:
pkg:
- installed
file:
- managed
- name: /etc/iptables/centrix.iptables
{% if grains['classtype'] == 'gtw' %}
- source: salt://iptables/gtw.iptables
{% elif grains['classtype'] == 'sbc' %}
- source: salt://iptables/sbc.iptables
{% elif grains['classtype'] == 'ops' %}
- source: salt://iptables/ops.iptables
{% else %}
- source: salt://iptables/base.iptables
{% endif %}
- user: root
- group: root
- mode: 644
- makedirs: True
cmd:
- run
- name: /usr/sbin/iptables-restore < /etc/iptables/centrix.iptables
- watch:
- file: iptables
- pkg: iptables
service:
- running
- watch:
- cmd: iptables
@centrix
Copy link
Author

centrix commented Dec 6, 2012

[root@blee blee]# salt '*' grains.item classtype
gtw01.localhost: ['gtw']

@centrix
Copy link
Author

centrix commented Dec 6, 2012

[root@blee blee]# salt '*' state.highstate

blee.localhost:

State: - no
Name:      states
Function:  None
    Result:    False
    Comment:   No Top file or external nodes data matches found
    Changes:

gtw01.localhost:

State: - file
Name:      /etc/iptables/centrix.iptables
Function:  managed
    Result:    False
    Comment:   Source file salt://iptables/base.iptables not found
    Changes:

State: - pkg
Name:      iptables
Function:  installed
    Result:    True
    Comment:   Package iptables is already installed
    Changes:

State: - cmd
Name:      /usr/sbin/iptables-restore < /etc/iptables/centrix.iptables
Function:  run
    Result:    False
    Comment:   One or more requisite failed
    Changes:

State: - service
Name:      iptables
Function:  running
    Result:    False
    Comment:   One or more requisite failed
    Changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment