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) }}
2
2
3
3
You can use a variable from the deploy
4
4
foo_variable contents is:{{ foo_variable }}
5
5
6
6
Example 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) }}
14
12
13
+ deb_packages: {{ host.get_fact(facts.deb.DebPackages)|join(', ') }}
Original file line number Diff line number Diff line change 7
7
import posixpath
8
8
import sys
9
9
import traceback
10
-
11
10
from datetime import timedelta
12
11
from fnmatch import fnmatch
13
12
from os import makedirs , path as os_path , walk
14
13
15
14
import six
16
-
17
15
from jinja2 import TemplateRuntimeError , TemplateSyntaxError , UndefinedError
18
16
17
+ import pyinfra
19
18
from pyinfra import logger
20
19
from pyinfra .api import (
21
20
FileDownloadCommand ,
@@ -901,6 +900,7 @@ def template(
901
900
data .setdefault ('host' , host )
902
901
data .setdefault ('state' , state )
903
902
data .setdefault ('inventory' , state .inventory )
903
+ data .setdefault ('facts' , pyinfra .facts )
904
904
905
905
# Render and make file-like it's output
906
906
try :
You can’t perform that action at this time.
0 commit comments