fix: make necessary modifications to get working on `salt-ssh`

* Similar situation to https://github.com/saltstack-formulas/logrotate-formula/pull/53
  - https://freenode.logbot.info/saltstack-formulas/20200507#c3819526-c3819581
  - https://freenode.logbot.info/saltstack-formulas/20200508#c3826763-c3826995
* Send template values by `context`
This commit is contained in:
Imran Iqbal 2020-05-08 07:33:10 +01:00
parent b64102f884
commit 34a112faab
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
3 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,8 @@ include:
- watch_in: - watch_in:
- service: postfix - service: postfix
- template: jinja - template: jinja
- context:
postfix: {{ postfix|tojson }}
{% if 'vmail' in pillar.get('postfix', '') %} {% if 'vmail' in pillar.get('postfix', '') %}
{{ postfix.config_path }}/virtual_alias_maps.cf: {{ postfix.config_path }}/virtual_alias_maps.cf:
@ -61,6 +63,7 @@ include:
{% endif %} {% endif %}
{% if salt['pillar.get']('postfix:manage_master_config', True) %} {% if salt['pillar.get']('postfix:manage_master_config', True) %}
{% import_yaml "postfix/services.yaml" as postfix_master_services %}
{{ postfix.config_path }}/master.cf: {{ postfix.config_path }}/master.cf:
file.managed: file.managed:
- source: salt://postfix/files/master.cf - source: salt://postfix/files/master.cf
@ -72,6 +75,9 @@ include:
- watch_in: - watch_in:
- service: postfix - service: postfix
- template: jinja - template: jinja
- context:
postfix: {{ postfix|tojson }}
postfix_master_services: {{ postfix_master_services|tojson }}
{% endif %} {% endif %}
{% if 'transport' in pillar.get('postfix', '') %} {% if 'transport' in pillar.get('postfix', '') %}

View File

@ -1,4 +1,3 @@
{%- from "postfix/map.jinja" import postfix with context -%}
{%- set config = salt['pillar.get']('postfix:config', {}) -%} {%- set config = salt['pillar.get']('postfix:config', {}) -%}
{#- " | list": Python3.6 retuns dict_keys here, which needs to be converted into a list here. -#} {#- " | list": Python3.6 retuns dict_keys here, which needs to be converted into a list here. -#}

View File

@ -1,7 +1,4 @@
{%- from "postfix/map.jinja" import postfix with context -%}
{%- set master_config = salt['pillar.get']('postfix:master_config', {}) -%} {%- set master_config = salt['pillar.get']('postfix:master_config', {}) -%}
{% import_yaml "postfix/services.yaml" as postfix_master_services %}
{#- {#-
# Handle the case that the pillar data does not provide any service # Handle the case that the pillar data does not provide any service
# configuration but submission parameters are provided in the pillar. # configuration but submission parameters are provided in the pillar.