Unify template support for classes (#185)

This commit is contained in:
Tim Byrne 2022-02-21 11:31:44 -06:00
parent 82bfd5e773
commit 50bf8716cd
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
4 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,7 @@ default host = >{{{{yadm.hostname}}}}<
default user = >{{{{yadm.user}}}}<
default distro = >{{{{yadm.distro}}}}<
default distro_family = >{{{{yadm.distro_family}}}}<
classes = >{{{{yadm.classes}}}}<
{{% if yadm.class == "else1" %}}
wrong else 1
{{% else %}}
@ -107,6 +108,8 @@ default host = >{LOCAL_HOST}<
default user = >{LOCAL_USER}<
default distro = >{LOCAL_DISTRO}<
default distro_family = >{LOCAL_DISTRO_FAMILY}<
classes = >{LOCAL_CLASS2}
{LOCAL_CLASS}<
Included section from else
Included section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Multiple lines

View File

@ -20,6 +20,7 @@ esh host = ><%=$YADM_HOSTNAME%><
esh user = ><%=$YADM_USER%><
esh distro = ><%=$YADM_DISTRO%><
esh distro_family = ><%=$YADM_DISTRO_FAMILY%><
esh classes = ><%=$YADM_CLASSES%><
<% if [ "$YADM_CLASS" = "wrongclass1" ]; then -%>
wrong class 1
<% fi -%>
@ -99,6 +100,7 @@ esh host = >{LOCAL_HOST}<
esh user = >{LOCAL_USER}<
esh distro = >{LOCAL_DISTRO}<
esh distro_family = >{LOCAL_DISTRO_FAMILY}<
esh classes = >{LOCAL_CLASS2} {LOCAL_CLASS}<
Included esh section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Included esh section for second class
Included esh section for arch = {LOCAL_ARCH} ({LOCAL_ARCH} repeated)

View File

@ -21,6 +21,7 @@ j2 host = >{{{{YADM_HOSTNAME}}}}<
j2 user = >{{{{YADM_USER}}}}<
j2 distro = >{{{{YADM_DISTRO}}}}<
j2 distro_family = >{{{{YADM_DISTRO_FAMILY}}}}<
j2 classes = >{{{{YADM_CLASSES}}}}<
{{%- if YADM_CLASS == "wrongclass1" %}}
wrong class 1
{{%- endif %}}
@ -102,6 +103,8 @@ j2 host = >{LOCAL_HOST}<
j2 user = >{LOCAL_USER}<
j2 distro = >{LOCAL_DISTRO}<
j2 distro_family = >{LOCAL_DISTRO_FAMILY}<
j2 classes = >{LOCAL_CLASS2}
{LOCAL_CLASS}<
Included j2 section for class = {LOCAL_CLASS} ({LOCAL_CLASS} repeated)
Included j2 section for second class
Included j2 section for arch = {LOCAL_ARCH} ({LOCAL_ARCH} repeated)

1
yadm
View File

@ -372,6 +372,7 @@ function template_default() {
BEGIN {
blank = "[ ]"
c["class"] = class
c["classes"] = classes
c["arch"] = arch
c["os"] = os
c["hostname"] = host