template-formula/TEMPLATE/subcomponent/config/file.sls
Dafydd Jones 2e8ded6565 refactor: improve reusability using an unique keyword TEMPLATE
BREAKING CHANGE: changed all state names and ids
2019-12-04 23:47:41 +00:00

27 lines
856 B
Text

# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import TEMPLATE with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_config_file }}
TEMPLATE-subcomponent-config-file-file-managed:
file.managed:
- name: {{ TEMPLATE.subcomponent.config }}
- source: {{ files_switch(['subcomponent-example.tmpl'],
lookup='TEMPLATE-subcomponent-config-file-file-managed',
use_subpath=True
)
}}
- mode: 644
- user: root
- group: {{ TEMPLATE.rootgroup }}
- makedirs: True
- template: jinja
- require_in:
- sls: {{ sls_config_file }}