diff --git a/template/macros.jinja b/template/macros.jinja index 0863cf8f..8fb5c469 100644 --- a/template/macros.jinja +++ b/template/macros.jinja @@ -7,24 +7,26 @@ Files Switch (TOFS) pattern. Params: - * prefix: pillar prefix to custom ':files_switch'. Colons ':' - are replaced by '/' to be used as directory prefix () * files: ordered list of files to look for * default_files_switch: if there's no pillar - ':files_switch' this is the ordered list of grains to + ':tofs:files_switch' this is the ordered list of grains to use as selector switch of the directories under "/files" * indent_witdh: indentation of the result value to conform to YAML - Example: + Example (based on a `tplroot` of `xxx`): If we have a state: Deploy configuration: file.managed: - name: /etc/yyy/zzz.conf - - source: {{ files_switch('xxx', ['/etc/yyy/zzz.conf', - '/etc/yyy/zzz.conf.jinja']) }} + - source: {{ files_switch( + salt['config.get']( + tplroot ~ ':tofs:files:Deploy configuration', + ['/etc/yyy/zzz.conf', '/etc/yyy/zzz.conf.jinja'] + ) + ) }} - template: jinja In a minion with id=theminion and os_family=RedHat, it's going to be