瀏覽代碼

Merge "Use forward dependency for ca_file instead of reverse one"

pr/fix/minion_dependencis
Filip Pytloun 7 年之前
父節點
當前提交
bc5fce96cb
共有 1 個文件被更改,包括 8 次插入8 次删除
  1. +8
    -8
      salt/minion/cert.sls

+ 8
- 8
salt/minion/cert.sls 查看文件

@@ -10,6 +10,8 @@

{%- if minion.cert is defined %}

{%- set created_ca_files = [] %}

{%- for cert_name,cert in minion.get('cert', {}).iteritems() %}
{%- set rowloop = loop %}

@@ -94,30 +96,26 @@ salt_minion_cert_{{ cert_name }}_dirs:
- watch:
- x509: {{ cert_file }}

{%- if cert.host is defined %}
{%- if cert.host is defined and ca_file not in created_ca_files %}
{%- for ca_path,ca_cert in salt['mine.get'](cert.host, 'x509.get_pem_entries').get(cert.host, {}).iteritems() %}

{%- if '/etc/pki/ca/'+cert.authority in ca_path %}

{{ ca_file }}_{{ rowloop.index }}:
{{ ca_file }}:
x509.pem_managed:
- name: {{ ca_file }}
- text: {{ ca_cert|replace('\n', '') }}
- watch:
- x509: {{ cert_file }}
{%- if cert.all_file is defined %}
- watch_in:
- cmd: salt_minion_cert_{{ cert_name }}_all
{%- endif %}

{{ ca_file }}_cert_permissions_{{ rowloop.index }}:
{{ ca_file }}_cert_permissions:
file.managed:
- name: {{ ca_file }}
- mode: 0644
- watch:
- x509: {{ ca_file }}

{{ ca_file }}_{{ rowloop.index }}_local_trusted_symlink:
{{ ca_file }}_local_trusted_symlink:
file.symlink:
- name: "{{ cacerts_dir }}/ca-{{ cert.authority }}.crt"
- target: {{ ca_file }}
@@ -127,6 +125,7 @@ salt_minion_cert_{{ cert_name }}_dirs:
{%- endif %}

{%- endfor %}
{%- do created_ca_files.append(ca_file) %}
{%- endif %}

{%- if cert.all_file is defined %}
@@ -136,6 +135,7 @@ salt_minion_cert_{{ cert_name }}_all:
- watch:
- x509: {{ key_file }}
- x509: {{ cert_file }}
- x509: {{ ca_file }}

{{ cert.all_file }}_cert_permissions:
file.managed:

Loading…
取消
儲存