Browse Source

Generate salt minion orchestration config

The patch adds _orchestrate.conf file to salt minion
configuration. Its template searches for "/meta/salt.yml"
file across all installed formulas and parses them if found.
As of now config will contain following data, e.g.:
orchestration:
  deploy:
    applications:
      cinder:
        priority: 150
      keystone:
        priority: 100

Application priorities will be used later for salt deploy
orchestration

Change-Id: I56b0d15e5a13ca4975d98b9675991f84885120e6
Related-PROD: PROD-19973
pull/73/head
Oleksii Grudev 6 years ago
parent
commit
0cd19b9ea1
2 changed files with 29 additions and 0 deletions
  1. +20
    -0
      salt/files/_orchestration.conf
  2. +9
    -0
      salt/master/minion.sls

+ 20
- 0
salt/files/_orchestration.conf View File

@@ -0,0 +1,20 @@
{%- from "salt/map.jinja" import master with context %}
{%- if master.enabled %}
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- set formulas = environment.get('formula', {}) %}
{%- set priorities = {'orchestration':{'deploy':{'applications':{}}}} %}
{%- for formula_name, formula in formulas.iteritems() %}
{%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %}
{%- set orch_fragment_file = formula_name+'/meta/salt.yml' %}
{%- macro load_orch_file() %}{% include orch_fragment_file %}{% endmacro %}
{%- set orch_yaml = load_orch_file()|load_yaml %}
{%- if orch_yaml.orchestration is defined %}
{%- do priorities['orchestration']['deploy']['applications'].update({ formula_name: orch_yaml['orchestration']['deploy']['applications'][formula_name] }) %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if priorities.orchestration.deploy.applications -%}
{{ priorities|yaml(False) }}
{%- endif %}
{%- endfor %}
{%- endif %}

+ 9
- 0
salt/master/minion.sls View File

@@ -4,6 +4,15 @@
include:
- salt.master.service

/etc/salt/minion.d/_orchestration.conf:
file.managed:
- source: salt://salt/files/_orchestration.conf
- user: root
- template: jinja
- makedirs: true
- require:
- {{ master.install_state }}

{%- if master.minion is defined %}

/srv/salt/minion_keys:

Loading…
Cancel
Save