Skip to content
Snippets Groups Projects
Select Git revision
  • 9490c868e05dd47fa5c5649ea187064f7988f75b
  • master default
2 results

certificates.sls

Blame
  • certificates.sls 1.78 KiB
    {% from "apache/map.jinja" import apache with context %}
    
    include:
      - apache
    
    {%- for site, confcert in salt['pillar.get']('apache:sites', {}).items() %}
    
    {% if confcert.SSLCertificateKeyFile is defined and confcert.SSLCertificateKeyFile_content is defined %}
    # Deploy {{ site }} key file
    apache_cert_config_{{ site }}_key_file:
      file.managed:
        - name: {{ confcert.SSLCertificateKeyFile }}
        - contents_pillar: apache:sites:{{ site }}:SSLCertificateKeyFile_content
        - makedirs: True
        - mode: 600
        - user: root
        - group: root
        - watch_in:
          - module: apache-reload
        - require_in:
          - module: apache-restart
          - module: apache-reload
          - service: apache
    {% endif %}
    
    {% if confcert.SSLCertificateFile is defined and confcert.SSLCertificateFile_content is defined %}
    # Deploy {{ site }} cert file
    apache_cert_config_{{ site }}_cert_file:
      file.managed:
        - name: {{ confcert.SSLCertificateFile }}
        - contents_pillar: apache:sites:{{ site }}:SSLCertificateFile_content
        - makedirs: True
        - mode: 600
        - user: root
        - group: root
        - watch_in:
          - module: apache-reload
        - require_in:
          - module: apache-restart
          - module: apache-reload
          - service: apache
    {% endif %}
    
    {% if confcert.SSLCertificateChainFile is defined and confcert.SSLCertificateChainFile_content is defined %}
    # Deploy {{ site }} bundle file
    apache_cert_config_{{ site }}_bundle_file:
      file.managed:
        - name: {{ confcert.SSLCertificateChainFile }}
        - contents_pillar: apache:sites:{{ site }}:SSLCertificateChainFile_content
        - makedirs: True
        - mode: 600
        - user: root
        - group: root
        - watch_in:
          - module: apache-reload
        - require_in:
          - module: apache-restart
          - module: apache-reload
          - service: apache
    {% endif %}
    
    {%- endfor %}