Compare commits

...

8 Commits

Author SHA1 Message Date
9cf4951f15
Disable journal dump on fail
Too noisy.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-05-01 00:08:59 +02:00
2abb801af7
Revert "style(vhost): reduce empty lines"
This reverts commit 4157db4d29.
New formatting did not work out as anticipated.
2023-04-30 17:01:49 +02:00
a6f1fb91d5
Disable pkg-deps
Backend webservers do not need modsecurity installed. Comment out the
state and add comment about suggestion for making the modsecurity
installation based on a conditional in the future.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-04-29 23:34:12 +02:00
e1685ffbeb
Simplify service management
In our environment a simple state ensuring the service is running and
having it reload on configuration changes should be more than
sufficient. Additionally, remove restart retries and useless log/config
dumping on failures.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-04-29 23:28:49 +02:00
b22a6cf1bb
Disable config.file hooks in service.running
Follow-up to 14aa73e1ab, do not indirectly
include config file management with requirements.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-04-29 23:14:30 +02:00
9f2bcb52b7
Disable register_site include
Avoid useless rendering of Debian specific state.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-04-29 22:54:13 +02:00
14aa73e1ab
Disable superfluous config states
We are using the files and directories shipped with the apache2
package and do not want them to be overwritten.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-04-29 22:44:14 +02:00
4157db4d29
style(vhost): reduce empty lines
Avoid lots of empty lines if options are not used.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-02-18 18:24:45 +01:00
4 changed files with 3 additions and 76 deletions

View File

@ -2,14 +2,4 @@
# vim: ft=sls
include:
- .file
# .modules.clean # disable (exclude from init state)
# .modules # enable by default (read pillars)
# .debian_full
- .flags
- .logrotate
- .manage_security
- .no_default_vhost
# .own_default_vhost
- .register_site
- .vhosts

View File

@ -30,10 +30,6 @@ apache-config-vhosts-standard-{{ id }}:
- require:
- pkg: apache-package-install-pkg-installed
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
{%- if site.get('DocumentRoot') != False %}
@ -57,10 +53,6 @@ apache-config-vhosts-standard-{{ id }}-cmd-run-a2en:
- require:
- file: apache-config-vhosts-standard-{{ id }}
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
{%- else %}
@ -72,10 +64,6 @@ apache-config-vhosts-standard-{{ id }}-cmd-run-a2dis:
- require:
- file: apache-config-vhosts-standard-{{ id }}
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
{%- endif %}

View File

@ -4,6 +4,7 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import apache with context %}
{#- consider moving this to an optional state or enabling it with a pillar option
{%- if 'deps' in apache.pkg and apache.pkg.deps and apache.pkg.deps is iterable and apache.pkg.deps is not string %}
apache-package-install-deps-pkg-installed:
pkg.installed:
@ -11,6 +12,7 @@ apache-package-install-deps-pkg-installed:
- require:
- apache-package-install-pkg-installed
{%- endif %}
#}
apache-package-install-pkg-installed:
{%- if grains.os_family == 'Windows' %}

View File

@ -2,63 +2,10 @@
# vim: ft=sls
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- set sls_config_registersite = tplroot ~ '.config.register_site' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}
include:
- {{ sls_config_file }}
- {{ sls_config_registersite }}
apache-service-running:
{%- if salt['pillar.get']('apache:manage_service_states', True) %}
{# By default run apache service states (unless pillar is false) #}
service.running:
- name: {{ apache.service.name }}
- enable: True
- watch:
- sls: {{ sls_config_file }}
- retry: {{ apache.retry_option|json }}
cmd.run:
- names:
- journalctl -xe -u {{ apache.service.name }} || tail -20 /var/log/messages || true
- (service {{ apache.service.name }} restart && service {{ apache.service.name }} status) || true
- cat {{ apache.config }}
- onfail:
- service: apache-service-running
{%- endif %}
{# The following states are by default inert and can be used #}
{# by other states to trigger a restart or reload as needed. #}
apache-service-running-restart:
module.wait:
{%- if apache.service_state in ['running'] %}
- name: service.restart
- m_name: {{ apache.service.name }}
{%- else %}
- name: cmd.run
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
- python_shell: True
{%- endif %}
- watch:
- sls: {{ sls_config_file }}
- require:
- sls: {{ sls_config_file }}
- service: apache-service-running
apache-service-running-reload:
module.wait:
{%- if apache.service_state in ['running'] %}
- name: service.reload
- m_name: {{ apache.service.name }}
{%- else %}
- name: cmd.run
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
- python_shell: True
{%- endif %}
- watch:
- sls: {{ sls_config_file }}
- require:
- sls: {{ sls_config_file }}
- service: apache-service-running
- reload: True