Bladeren bron

all the fixes for `clean` states to work properly

tags/v1.2.1
Imran Iqbal 3 jaren geleden
bovenliggende
commit
9d3e62c3cc
No account linked to committer's email address
4 gewijzigde bestanden met toevoegingen van 18 en 31 verwijderingen
  1. +9
    -21
      apache/config/certificates/clean.sls
  2. +2
    -0
      apache/config/clean.sls
  3. +3
    -5
      apache/config/modules/clean.sls
  4. +4
    -5
      apache/config/vhosts/cleanup.sls

+ 9
- 21
apache/config/certificates/clean.sls Bestand weergeven

@@ -2,11 +2,11 @@
# vim: ft=sls

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}

include:
- {{ sls_service_running }}
- {{ sls_service_clean }}

{%- for site, cert in salt['pillar.get']('apache:sites', {}).items() %}

@@ -15,12 +15,8 @@ include:
apache_cert_config_clean_{{ site }}_key_file:
file.absent:
- name: {{ cert.SSLCertificateKeyFile }}
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
- require:
- sls: {{ sls_service_clean }}

{%- endif %}
{%- if cert.SSLCertificateFile is defined %}
@@ -28,25 +24,17 @@ apache_cert_config_clean_{{ site }}_key_file:
apache_cert_config_clean_{{ site }}_cert_file:
file.absent:
- name: {{ cert.SSLCertificateFile }}
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
- require:
- sls: {{ sls_service_clean }}

{%- endif %}
{%- if cert.SSLCertificateChainFile is defined %}

apache_cert_config_clean_{{ site }}_bundle_file:
file.managed:
file.absent:
- name: {{ cert.SSLCertificateChainFile }}
- watch_in:
- module: apache-service-running-reload
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- service: apache-service-running
- require:
- sls: {{ sls_service_clean }}

{%- endif %}
{%- endfor %}

+ 2
- 0
apache/config/clean.sls Bestand weergeven

@@ -3,6 +3,7 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- set sls_modules_clean = tplroot ~ '.config.modules.clean' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}

include:
@@ -21,3 +22,4 @@ apache-config-clean-file-absent:
- {{ apache.confdir }}/server-status{{ apache.confext }}
- require:
- sls: {{ sls_service_clean }}
- sls: {{ sls_modules_clean }}

+ 3
- 5
apache/config/modules/clean.sls Bestand weergeven

@@ -3,11 +3,11 @@

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
{%- set sls_service_dead = tplroot ~ '.service.clean' %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}

include:
- {{ sls_service_dead }}
- {{ sls_service_clean }}

{%- set existing_states = salt['cp.list_states']() %}
{%- for module in salt['pillar.get']('apache:modules:disabled', []) %}
@@ -45,8 +45,6 @@ apache-config-modules-{{ module }}-disable:

- order: 225
- require:
- sls: {{ sls_service_dead }}
- require_in:
- pkg: apache-package-clean-pkg-removed
- sls: {{ sls_service_clean }}

{%- endfor %}

+ 4
- 5
apache/config/vhosts/cleanup.sls Bestand weergeven

@@ -2,13 +2,13 @@
# vim: ft=sls

{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/map.jinja" import apache with context %}

{%- if grains.os_family == 'Debian' %}

include:
- {{ sls_service_running }}
- {{ sls_service_clean }}

{%- set dirpath = '/etc/apache2/sites-enabled' %}
{# Add . and .. to make it easier to not clean those #}
@@ -32,9 +32,8 @@ apache-config-vhosts-cleanup-{{ filename }}-cmd-run:
cmd.run:
- name: a2dissite {{ filename }} || true
- onlyif: "test -L {{ dirpath }}/{{ filename }} || test -f {{ dirpath }}/{{ filename }}"
- require_in:
- module: apache-service-running-restart
- module: apache-service-running-reload
- require:
- sls: {{ sls_service_clean }}

{%- endif %}
{%- endfor %}

Laden…
Annuleren
Opslaan