Browse Source

Merge pull request #13 from KennethWilke/master

Isolated package mapping and some fixes
tags/v0.57.0
Seth House 11 years ago
parent
commit
c0e2423707
4 changed files with 28 additions and 15 deletions
  1. +3
    -3
      salt/files/minion
  2. +3
    -5
      salt/master.sls
  3. +4
    -7
      salt/minion.sls
  4. +18
    -0
      salt/package-map.jinja

+ 3
- 3
salt/files/minion View File

# #
# The failhard option tells the minions to stop immediately after the first # The failhard option tells the minions to stop immediately after the first
# failure detected in the state execution, defaults to False # failure detected in the state execution, defaults to False
{{ get_config(failhard'', 'False') }}
{{ get_config('failhard', 'False') }}
# #
# autoload_dynamic_modules Turns on automatic loading of modules found in the # autoload_dynamic_modules Turns on automatic loading of modules found in the
# environments on the master. This is turned on by default, to turn of # environments on the master. This is turned on by default, to turn of
# The Salt pillar is searched for locally if file_client is set to local. If # The Salt pillar is searched for locally if file_client is set to local. If
# this is the case, and pillar data is defined, then the pillar_roots need to # this is the case, and pillar data is defined, then the pillar_roots need to
# also be configured on the minion: # also be configured on the minion:
{% if 'pillar_roots' in master -%}
{% if 'pillar_roots' in minion -%}
pillar_roots: pillar_roots:
{% for name, roots in master['pillar_roots'].items() -%}
{% for name, roots in minion['pillar_roots'].items() -%}
{{ name }}: {{ name }}:
{% for dir in roots -%} {% for dir in roots -%}
- {{ dir }} - {{ dir }}

+ 3
- 5
salt/master.sls View File

{% from "salt/package-map.jinja" import pkgs with context %}

salt-master: salt-master:
pkg.installed: pkg.installed:
{% if grains['os_family'] in ['RedHat', 'Debian'] %}
- name: salt-master
{% else %}
- name: salt
{% endif %}
- name: {{ pkgs['salt-master'] }}
file.managed: file.managed:
- name: /etc/salt/master - name: /etc/salt/master
- template: jinja - template: jinja

+ 4
- 7
salt/minion.sls View File

{% from "salt/package-map.jinja" import pkgs with context %}

salt-minion: salt-minion:
pkg.installed: pkg.installed:
{% if grains['os_family'] in ['RedHat', 'Debian'] %}
- name: salt-minion
{% else %}
- name: salt
{% endif %}
- name: {{ pkgs['salt-minion'] }}
file.managed: file.managed:
- name: /etc/salt/minion - name: /etc/salt/minion
- template: jinja - template: jinja
- source: salt://salt/files/minion - source: salt://salt/files/minion
service.running: service.running:
- enable: True - enable: True
- require:
- pkg: salt-minion
- watch: - watch:
- pkg: salt-minion
- file: salt-minion - file: salt-minion

+ 18
- 0
salt/package-map.jinja View File

{% set package_table = {
'Debian': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion'},
'Ubuntu': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion'},
'CentOS': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion'},
'Fedora': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion'},
'RedHat': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion'}
} %}

{% if 'package_table' in pillar %}
{% set pkgs = pillar['package_table'] %}
{% elif grains['os'] in package_table %}
{% set pkgs = package_table[grains['os']] %}
{% endif %}

Loading…
Cancel
Save