mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2026-09-24 02:34:57 +02:00
feat(map): generate a YAML file to validate map.jinja
We provide a new `_mapdata` state which generate a `/tmp/salt_mapdata_dump.yaml` to be validated by `Inspec`.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
---
|
||||
{#- Get the `tplroot` from `tpldir` #}
|
||||
{%- set tplroot = tpldir.split('/')[0] %}
|
||||
{%- from tplroot ~ "/map.jinja" import openssh with context %}
|
||||
{%- from tplroot ~ "/map.jinja" import ssh_config with context %}
|
||||
{%- from tplroot ~ "/map.jinja" import sshd_config with context %}
|
||||
|
||||
{%- set output_file = '/tmp/salt_mapdata_dump.yaml' %}
|
||||
{%- set map = {
|
||||
'openssh': openssh,
|
||||
'ssh_config': ssh_config,
|
||||
'sshd_config': sshd_config,
|
||||
} %}
|
||||
|
||||
{%- do salt['log.debug']( map | yaml(False) ) %}
|
||||
|
||||
{{ tplroot }}-mapdata-dump:
|
||||
file.managed:
|
||||
- name: {{ output_file }}
|
||||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ map | yaml }}
|
||||
Reference in New Issue
Block a user