File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 1- This file was last modified by pyinfra on {{ host.fact.date }}
1+ This file was last modified by pyinfra on {{ host.get_fact(facts.server.Date) }}
22
33You can use a variable from the deploy
44foo_variable contents is:{{ foo_variable }}
55
66Example host templating values:
7- hostname: {{ host.fact.hostname }}
8- os: {{ host.fact.os }}
9- arch: {{ host.fact.arch }}
10- cpus: {{ host.fact.cpus }}
11- os_version: {{ host.fact.os_version }}
12-
13- deb_packages: {{ host.fact.deb_packages|join(', ') }}
7+ hostname: {{ host.get_fact(facts.server.Hostname) }}
8+ os: {{ host.get_fact(facts.server.Os) }}
9+ arch: {{ host.get_fact(facts.server.Arch) }}
10+ cpus: {{ host.get_fact(facts.hardware.Cpus) }}
11+ os_version: {{ host.get_fact(facts.server.OsVersion) }}
1412
13+ deb_packages: {{ host.get_fact(facts.deb.DebPackages)|join(', ') }}
Original file line number Diff line number Diff line change 77import posixpath
88import sys
99import traceback
10-
1110from datetime import timedelta
1211from fnmatch import fnmatch
1312from os import makedirs , path as os_path , walk
1413
1514import six
16-
1715from jinja2 import TemplateRuntimeError , TemplateSyntaxError , UndefinedError
1816
17+ import pyinfra
1918from pyinfra import logger
2019from pyinfra .api import (
2120 FileDownloadCommand ,
@@ -901,6 +900,7 @@ def template(
901900 data .setdefault ('host' , host )
902901 data .setdefault ('state' , state )
903902 data .setdefault ('inventory' , state .inventory )
903+ data .setdefault ('facts' , pyinfra .facts )
904904
905905 # Render and make file-like it's output
906906 try :
You can’t perform that action at this time.
0 commit comments