Browse Source

created a map.jinja and updated openssh state to use those values

tags/v0.41.0
Kenny Do 11 years ago
parent
commit
0a2468d87a
2 changed files with 28 additions and 11 deletions
  1. +10
    -11
      openssh/init.sls
  2. +18
    -0
      openssh/map.jinja

+ 10
- 11
openssh/init.sls View File

{% from "openssh/map.jinja" import openssh with context %}

openssh: openssh:
pkg:
- installed
{% if grains['os_family'] == 'Debian' %}
- name: openssh-server
{% endif %}
pkg.installed:
- name: {{ openssh.server }}
service.running: service.running:
- enable: True - enable: True
- name: ssh
- name: {{ openssh.service }}
- require: - require:
- pkg: openssh
- pkg: {{ openssh.server }}
- file: sshd_banner - file: sshd_banner
- watch: - watch:
- file: sshd_config - file: sshd_config


sshd_config: sshd_config:
file.managed: file.managed:
- name: /etc/ssh/sshd_config
- source: salt://openssh/files/sshd_config
- name: {{ openssh.sshd_config }}
- source: {{ openssh.sshd_config_src }}


sshd_banner: sshd_banner:
file.managed: file.managed:
- name: /etc/ssh/banner
- source: salt://openssh/files/banner
- name: {{ openssh.banner }}
- source: {{ openssh.banner_src }}
- template: jinja - template: jinja

+ 18
- 0
openssh/map.jinja View File

{% set openssh = salt['grains.filter_by']({
'Debian': {
'server': 'openssh-server',
'service': 'ssh',
'sshd_config': '/etc/ssh/sshd_config',
'sshd_config_src': 'salt://openssh/files/sshd_config',
'banner': '/etc/ssh/banner',
'banner_src': 'salt://openssh/files/banner',
},
'RedHat': {
'server': 'openssh-server',
'service': 'sshd',
'sshd_config': '/etc/ssh/sshd_config',
'sshd_config_src': 'salt://openssh/files/sshd_config',
'banner': '/etc/ssh/banner',
'banner_src': 'salt://openssh/files/banner',
},
}, merge=salt['pillar.get']('openssh:lookup')) %}

Loading…
Cancel
Save