Browse Source

SOA relations modeling

Change-Id: Icd6334902ca47d83ae263905d65ef91b8e6a7335
soa
Ales Komarek 7 years ago
parent
commit
d1707346ad
2 changed files with 45 additions and 1 deletions
  1. +31
    -0
      salt/meta/meta.yml
  2. +14
    -1
      salt/meta/salt.yml

+ 31
- 0
salt/meta/meta.yml View File

@@ -0,0 +1,31 @@
graph:
{%- if pillar.get('salt', {}).minion is defined %}
{%- from "salt/map.jinja" import minion with context %}
- host: {{ grains.id }}
service: salt.minion
type: software-config
relations:
{%- if minion.master is defined %}
- service: salt-master
{%- if minion.master.host in ['127.0.0.1', 'localhost'] %}
host: {{ grains.id }}
{%- else %}
host_from_target: {{ minion.master.host }}
{%- endif %}
direction: source
type: tcp-0mq
{%- endif %}
{%- endif %}
{%- if pillar.get('salt', {}).master is defined %}
{%- from "salt/map.jinja" import master with context %}
- host: {{ grains.id }}
service: salt.master
type: software-config
relations:
{%- if master.pillar.engine == 'reclass' %}
- host: {{ grains.id }}
service: reclass.storage
direction: source
type: local-file
{%- endif %}
{%- endif %}

+ 14
- 1
salt/meta/salt.yml View File

@@ -1,3 +1,17 @@
{%- set service_grains = {'salt': {'graph': []}} %}
{%- for service_name, service in pillar.items() %}
{%- set grains_fragment_file = service_name+'/meta/meta.yml' %}
{%- macro load_grains_file() %}{% include grains_fragment_file ignore missing %}{% endmacro %}
{%- set grains_yaml = load_grains_file()|load_yaml %}
{%- if grains_yaml is mapping %}
{%- for node in grains_yaml.graph %}
{%- do service_grains.salt.graph.append(node) %}
{%- endfor %}
{%- endif %}
{%- endfor %}
grain:
salt:
{{ service_grains|yaml(False)|indent(4) }}
orchestrate:
master:
priority: 60
@@ -7,7 +21,6 @@ orchestrate:
priority: 400
require:
- salt: salt.master

minion:
{%- if pillar.get('salt', {}).get('minion', {}).get('ca') %}
pki:

Loading…
Cancel
Save