Reload service rather than restarttags/v0.6.2
*.swp | *.swp | ||||
*.tmp | *.tmp | ||||
/.project | /.project | ||||
.kitchen/ | |||||
.kitchen.local.yml |
--- | |||||
driver: | |||||
name: vagrant | |||||
platforms: | |||||
- name: centos-7.2 | |||||
provisioner: | |||||
name: salt_solo | |||||
salt_install: bootstrap | |||||
salt_bootstrap_url: https://bootstrap.saltstack.com | |||||
salt_version: latest | |||||
formula: firewalld | |||||
pillars: | |||||
top.sls: | |||||
base: | |||||
'*': | |||||
- firewalld | |||||
firewalld.sls: | |||||
firewalld: | |||||
enabled: True | |||||
services: | |||||
glusterfs: | |||||
short: glusterfs | |||||
description: 'GlusterFS network filesystem' | |||||
ports: | |||||
tcp: | |||||
- 24007-24008 | |||||
- 49152-49200 | |||||
suites: | |||||
- name: default | |||||
provisioner: | |||||
salt_bootstrap_options: -X -d | |||||
state_top: | |||||
base: | |||||
'*': | |||||
- firewalld |
- mode: 750 | - mode: 750 | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
config_firewalld: | config_firewalld: | ||||
file.managed: | file.managed: | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- file: directory_firewalld | - file: directory_firewalld | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config |
# == Define: firewalld.direct | # == Define: firewalld.direct | ||||
# | # | ||||
# This defines a configuration for permanent direct chains, | |||||
# This defines a configuration for permanent direct chains, | |||||
# rules and passtthroughs, see firewalld.direct (5) man page. | # rules and passtthroughs, see firewalld.direct (5) man page. | ||||
{%- if firewalld.get('direct', False) %} | {%- if firewalld.get('direct', False) %} | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- file: directory_firewalld | - file: directory_firewalld | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
- context: | - context: | ||||
direct: {{ firewalld.direct|json }} | direct: {{ firewalld.direct|json }} | ||||
{%- endif %} | {%- endif %} |
iptables: | iptables: | ||||
service.disabled: | service.disabled: | ||||
- enable: False | - enable: False | ||||
ip6tables: | ip6tables: | ||||
service.disabled: | service.disabled: | ||||
- enable: False | - enable: False | ||||
pkg.installed: | pkg.installed: | ||||
- name: {{ firewalld.package }} | - name: {{ firewalld.package }} | ||||
service_firewalld_running: | |||||
service_firewalld: | |||||
service.running: | service.running: | ||||
- name: {{ firewalld.service }} | - name: {{ firewalld.service }} | ||||
- enable: True # start on boot | - enable: True # start on boot | ||||
- service: iptables # ensure it's stopped | - service: iptables # ensure it's stopped | ||||
- service: ip6tables # ensure it's stopped | - service: ip6tables # ensure it's stopped | ||||
service_firewalld: | |||||
module.wait: | |||||
- name: service.restart | |||||
- m_name: {{ firewalld.service }} | |||||
reload_firewalld: | |||||
cmd.wait: | |||||
- name: 'firewall-cmd --reload' | |||||
- require: | - require: | ||||
- pkg: package_firewalld | |||||
- file: config_firewalld | |||||
- service: iptables # ensure it's stopped | |||||
- service: ip6tables # ensure it's stopped | |||||
- service: service_firewalld | |||||
{% else %} | {% else %} | ||||
service_firewalld_dead: | |||||
service_firewalld: | |||||
service.dead: | service.dead: | ||||
- name: {{ firewalld.service }} | - name: {{ firewalld.service }} | ||||
- enable: False # don't start on boot | - enable: False # don't start on boot |
- mode: 750 | - mode: 750 | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
# == Define: firewalld.ipsets | # == Define: firewalld.ipsets | ||||
# | # | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- file: directory_firewalld_ipsets | - file: directory_firewalld_ipsets | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
- context: | - context: | ||||
name: {{ z_name }} | name: {{ z_name }} | ||||
ipset: {{ v }} | ipset: {{ v }} |
- mode: 750 | - mode: 750 | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
# == Define: firewalld.services | # == Define: firewalld.services | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- file: directory_firewalld_services | - file: directory_firewalld_services | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
- context: | - context: | ||||
name: {{ s_name }} | name: {{ s_name }} | ||||
service: {{ v|json }} | service: {{ v|json }} |
- mode: 750 | - mode: 750 | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
# == Define: firewalld.zones | # == Define: firewalld.zones | ||||
# | # | ||||
- require: | - require: | ||||
- pkg: package_firewalld # make sure package is installed | - pkg: package_firewalld # make sure package is installed | ||||
- file: directory_firewalld_zones | - file: directory_firewalld_zones | ||||
- listen_in: | |||||
- module: service_firewalld # restart service | |||||
- require_in: | |||||
- service: service_firewalld | |||||
- watch_in: | |||||
- cmd: reload_firewalld # reload firewalld config | |||||
- context: | - context: | ||||
name: {{ z_name }} | name: {{ z_name }} | ||||
zone: {{ v|json }} | zone: {{ v|json }} |
require 'serverspec' | |||||
set :backend, :exec | |||||
describe service('firewalld') do | |||||
it { should be_running } | |||||
end |