Procházet zdrojové kódy

Merge pull request #4 from kennydo/use_map

Better Configuration and State Modularity
tags/v0.41.0
Erik Johnson před 11 roky
rodič
revize
531a68c4b9
5 změnil soubory, kde provedl 55 přidání a 24 odebrání
  1. +9
    -4
      README.rst
  2. +10
    -0
      openssh/banner.sls
  3. +12
    -0
      openssh/config.sls
  4. +6
    -20
      openssh/init.sls
  5. +18
    -0
      openssh/map.jinja

+ 9
- 4
README.rst Zobrazit soubor

@@ -1,7 +1,12 @@
openssh
=======
Install and configure an openssh server.

openssh
-------

Install openssh and set up the daemon, install a useful banner as well
States
------
``openssh``
Installs the ``openssh`` package and service.
``openssh.config``
Installs the configuration file included in this formula (under "openssh/files").
``openssh.banner``
Installs a banner that users see when SSH-ing in.

+ 10
- 0
openssh/banner.sls Zobrazit soubor

@@ -0,0 +1,10 @@
{% from "openssh/map.jinja" import openssh with context %}

include:
- openssh

sshd_banner:
file.managed:
- name: {{ openssh.banner }}
- source: {{ openssh.banner_src }}
- template: jinja

+ 12
- 0
openssh/config.sls Zobrazit soubor

@@ -0,0 +1,12 @@
{% from "openssh/map.jinja" import openssh with context %}

include:
- openssh

sshd_config:
file.managed:
- name: {{ openssh.sshd_config }}
- source: {{ openssh.sshd_config_src }}
- watch_in:
- service: {{ openssh.service }}


+ 6
- 20
openssh/init.sls Zobrazit soubor

@@ -1,25 +1,11 @@
{% from "openssh/map.jinja" import openssh with context %}

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

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

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

+ 18
- 0
openssh/map.jinja Zobrazit soubor

@@ -0,0 +1,18 @@
{% 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')) %}

Načítá se…
Zrušit
Uložit