qusal/salt/utils/macros/clone-template.sls

31 lines
633 B
Plaintext
Raw Normal View History

2023-11-13 09:33:28 -05:00
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{#
Usage:
1: Import this template:
{% from 'utils/macros/clone-template.sls' import clone_template -%}
2: Set template to clone from and the clone name:
{{ clone_template('debian-minimal', sls_path) }}
#}
{% macro clone_template(source, name) -%}
{%- import source ~ "/template.jinja" as template -%}
include:
- {{ source }}.create
"tpl-{{ name }}-clone":
qvm.clone:
- require:
- sls: {{ source }}.create
- source: {{ template.template }}
- name: tpl-{{ name }}
{% endmacro -%}