Saltstack Official OpenSSH Formula
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

62 lines
1.7KB

  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 %}
  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"] %}