Saltstack Official OpenSSH Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

67 rindas
1.9KB

  1. {#- -*- coding: utf-8 -*- #}
  2. {#- vim: ft=jinja #}
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split("/")[0] %}
  5. {%- from tplroot ~ "/libmapstack.jinja" import mapstack with context %}
  6. {#- Where to lookup parameters source files #}
  7. {%- set formula_param_dir = tplroot ~ "/parameters" %}
  8. {#- List of sources to lookup for parameters #}
  9. {#- Fallback to previously used grains plus minion `id` #}
  10. {%- set map_sources = [
  11. "Y:G@osarch",
  12. "Y:G@os_family",
  13. "Y:G@os",
  14. "Y:G@osfinger",
  15. "C@" ~ tplroot ~ ":lookup",
  16. "C@" ~ tplroot,
  17. "Y:G@id",
  18. ] %}
  19. {%- set _map_settings = mapstack(
  20. matchers=["map_jinja.yaml"],
  21. defaults={
  22. "values": {"sources": map_sources}
  23. },
  24. log_prefix="map.jinja configuration: ",
  25. )
  26. | load_yaml %}
  27. {%- set map_sources = _map_settings | traverse("values:sources") %}
  28. {%- do salt["log.debug"](
  29. "map.jinja: load parameters from sources:\n"
  30. ~ map_sources
  31. | yaml(False)
  32. ) %}
  33. {#- Load formula parameters values #}
  34. {%- set _formula_matchers = ["defaults.yaml"] + map_sources %}
  35. {%- set _formula_settings = mapstack(
  36. matchers=_formula_matchers,
  37. dirs=[formula_param_dir],
  38. defaults={
  39. "values": {},
  40. "merge_strategy": salt["config.get"](tplroot ~ ":strategy", None),
  41. "merge_lists": salt["config.get"](tplroot ~ ":merge_lists", False),
  42. },
  43. log_prefix="map.jinja: ",
  44. )
  45. | load_yaml %}
  46. {#- Make sure to track `map.jinja` configuration with `_mapdata` #}
  47. {%- do _formula_settings["values"].update(
  48. {
  49. "map_jinja": _map_settings["values"]
  50. }
  51. ) %}
  52. {%- do salt["log.debug"]("map.jinja: save parameters in variable 'mapdata'") %}
  53. {%- set mapdata = _formula_settings["values"] %}
  54. {#- Per formula post-processing of `mapdata` if it exists #}
  55. {%- do salt["log.debug"]("map.jinja: post-processing of 'mapdata'") %}
  56. {%- include tplroot ~ "/post-map.jinja" ignore missing %}