|
|
|
|
|
|
|
|
include: |
|
|
include: |
|
|
- nginx.ng.service |
|
|
- nginx.ng.service |
|
|
|
|
|
|
|
|
|
|
|
{% set certificates_path = salt['pillar.get']('nginx:ng:certificates_path', '/etc/nginx/ssl') %} |
|
|
{%- for domain in salt['pillar.get']('nginx:ng:certificates', {}).keys() %} |
|
|
{%- for domain in salt['pillar.get']('nginx:ng:certificates', {}).keys() %} |
|
|
|
|
|
|
|
|
nginx_{{ domain }}_ssl_certificate: |
|
|
nginx_{{ domain }}_ssl_certificate: |
|
|
file.managed: |
|
|
file.managed: |
|
|
- name: /etc/nginx/ssl/{{ domain }}.crt |
|
|
|
|
|
|
|
|
- name: {{ certificates_path }}/{{ domain }}.crt |
|
|
- makedirs: True |
|
|
- makedirs: True |
|
|
- contents_pillar: nginx:ng:certificates:{{ domain }}:public_cert |
|
|
- contents_pillar: nginx:ng:certificates:{{ domain }}:public_cert |
|
|
- watch_in: |
|
|
- watch_in: |
|
|
|
|
|
|
|
|
{% if salt['pillar.get']("nginx:ng:certificates:{}:private_key".format(domain)) %} |
|
|
{% if salt['pillar.get']("nginx:ng:certificates:{}:private_key".format(domain)) %} |
|
|
nginx_{{ domain }}_ssl_key: |
|
|
nginx_{{ domain }}_ssl_key: |
|
|
file.managed: |
|
|
file.managed: |
|
|
- name: /etc/nginx/ssl/{{ domain }}.key |
|
|
|
|
|
|
|
|
- name: {{ certificates_path }}/{{ domain }}.key |
|
|
- mode: 600 |
|
|
- mode: 600 |
|
|
- makedirs: True |
|
|
- makedirs: True |
|
|
- contents_pillar: nginx:ng:certificates:{{ domain }}:private_key |
|
|
- contents_pillar: nginx:ng:certificates:{{ domain }}:private_key |