Переглянути джерело

Merge branch 'Python3' of salt/salt-formula into master

master
Nate Bohman 6 роки тому
джерело
коміт
320e8dd7a0
27 змінених файлів з 69 додано та 69 видалено
  1. +2
    -2
      _modules/virtng.py
  2. +2
    -2
      salt/control/cloud.sls
  3. +2
    -2
      salt/control/maas.sls
  4. +2
    -2
      salt/control/virt.sls
  5. +1
    -1
      salt/files/_acl.conf
  6. +1
    -1
      salt/files/_engine.conf
  7. +2
    -2
      salt/files/_orchestration.conf
  8. +2
    -2
      salt/files/_renderer.conf
  9. +1
    -1
      salt/files/etc_default_salt-minion
  10. +1
    -1
      salt/files/map
  11. +5
    -5
      salt/files/master.conf
  12. +2
    -2
      salt/files/minion.conf
  13. +1
    -1
      salt/files/orchestrate.sls
  14. +2
    -2
      salt/files/profiles.conf
  15. +1
    -1
      salt/files/providers.conf
  16. +1
    -1
      salt/files/roster
  17. +5
    -5
      salt/files/salt-state-graph.py
  18. +14
    -14
      salt/master/env.sls
  19. +1
    -1
      salt/master/minion.sls
  20. +4
    -4
      salt/master/orchestrate.sls
  21. +3
    -3
      salt/master/pillar.sls
  22. +5
    -5
      salt/meta/salt.yml
  23. +1
    -1
      salt/minion/ca.sls
  24. +4
    -4
      salt/minion/cert.sls
  25. +1
    -1
      salt/minion/grains.sls
  26. +2
    -2
      salt/minion/proxy.sls
  27. +1
    -1
      salt/minion/service.sls

+ 2
- 2
_modules/virtng.py Переглянути файл

if kwargs.get('seed') == 'cloud-init': if kwargs.get('seed') == 'cloud-init':
# Recursive dict update. # Recursive dict update.
def rec_update(d, u): def rec_update(d, u):
for k, v in u.iteritems():
for k, v in u.items():
if isinstance(v, collections.Mapping): if isinstance(v, collections.Mapping):
d[k] = rec_update(d.get(k, {}), v) d[k] = rec_update(d.get(k, {}), v)
else: else:
elif isinstance(instance, collections.Mapping): elif isinstance(instance, collections.Mapping):
if isinstance(instance, OrderedDict): if isinstance(instance, OrderedDict):
instance = dict(instance) instance = dict(instance)
for k, v in instance.iteritems():
for k, v in instance.items():
instance[k] = OrderedDict_to_dict(v) instance[k] = OrderedDict_to_dict(v)
return instance return instance
else: else:

+ 2
- 2
salt/control/cloud.sls Переглянути файл

file.directory: file.directory:
- makedirs: true - makedirs: true


{%- for cluster_name, cluster in control.cluster.iteritems() %}
{%- for cluster_name, cluster in control.cluster.items() %}


{%- if cluster.engine == "cloud" %} {%- if cluster.engine == "cloud" %}


file.directory: file.directory:
- makedirs: true - makedirs: true


{%- for node_name, node in cluster.node.iteritems() %}
{%- for node_name, node in cluster.node.items() %}


/srv/salt/cloud/userdata/{{cluster_name }}/{{ node_name }}.conf: /srv/salt/cloud/userdata/{{cluster_name }}/{{ node_name }}.conf:
file.managed: file.managed:

+ 2
- 2
salt/control/maas.sls Переглянути файл

pkg.installed: pkg.installed:
- names: {{ control.maas_pkgs }} - names: {{ control.maas_pkgs }}


{%- for cluster_name, cluster in control.cluster.iteritems() %}
{%- for cluster_name, cluster in control.cluster.items() %}


{%- if cluster.engine == "maas" %} {%- if cluster.engine == "maas" %}


{%- for node_name, node in cluster.node.iteritems() %}
{%- for node_name, node in cluster.node.items() %}


{# TODO: mass.server_active implementation #} {# TODO: mass.server_active implementation #}



+ 2
- 2
salt/control/virt.sls Переглянути файл

- pkg: salt_control_virt_packages - pkg: salt_control_virt_packages
{%- endif %} {%- endif %}


{%- for cluster_name, cluster in control.cluster.iteritems() %}
{%- for cluster_name, cluster in control.cluster.items() %}


{%- if cluster.engine == "virt" %} {%- if cluster.engine == "virt" %}


{%- endif %} {%- endif %}




{%- for node_name, node in cluster.node.iteritems() %}
{%- for node_name, node in cluster.node.items() %}


{%- if node.name is defined %} {%- if node.name is defined %}
{%- set node_name = node.name %} {%- set node_name = node.name %}

+ 1
- 1
salt/files/_acl.conf Переглянути файл



external_auth: external_auth:
pam: pam:
{%- for user_name, user in master.user.iteritems() %}
{%- for user_name, user in master.user.items() %}
{{ user_name }}: {{ user.permissions|yaml }} {{ user_name }}: {{ user.permissions|yaml }}
{%- endfor %} {%- endfor %}



+ 1
- 1
salt/files/_engine.conf Переглянути файл

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


engines_dirs: engines_dirs:
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}
- /srv/salt/env/{{ environment_name }}/_engines - /srv/salt/env/{{ environment_name }}/_engines
{%- endfor %} {%- endfor %}



+ 2
- 2
salt/files/_orchestration.conf Переглянути файл

{%- from "salt/map.jinja" import master with context %} {%- from "salt/map.jinja" import master with context %}
{%- if master.enabled %} {%- if master.enabled %}
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}
{%- set formulas = environment.get('formula', {}) %} {%- set formulas = environment.get('formula', {}) %}
{%- set priorities = {'orchestration':{'deploy':{'applications':{}}, 'upgrade': {'applications': {}}}} %} {%- set priorities = {'orchestration':{'deploy':{'applications':{}}, 'upgrade': {'applications': {}}}} %}
{%- for formula_name, formula in formulas.iteritems() %}
{%- for formula_name, formula in formulas.items() %}
{%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %} {%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %}
{%- set orch_fragment_file = formula_name+'/meta/salt.yml' %} {%- set orch_fragment_file = formula_name+'/meta/salt.yml' %}
{%- macro load_orch_file() %}{% include orch_fragment_file %}{% endmacro %} {%- macro load_orch_file() %}{% include orch_fragment_file %}{% endmacro %}

+ 2
- 2
salt/files/_renderer.conf Переглянути файл

{%- if renderer.get('jinja_sls', {}) | length > 0 %} {%- if renderer.get('jinja_sls', {}) | length > 0 %}


jinja_sls_env: jinja_sls_env:
{% for key, value in renderer.jinja_sls.iteritems() %}
{% for key, value in renderer.jinja_sls.items() %}
{{ key }}: "{{ value }}" {{ key }}: "{{ value }}"
{%- endfor %} {%- endfor %}


{%- if renderer.get('jinja', {}) | length > 0 %} {%- if renderer.get('jinja', {}) | length > 0 %}


jinja_env: jinja_env:
{% for key, value in renderer.jinja.iteritems() %}
{% for key, value in renderer.jinja.items() %}
{{ key }}: "{{ value }}" {{ key }}: "{{ value }}"
{%- endfor %} {%- endfor %}



+ 1
- 1
salt/files/etc_default_salt-minion Переглянути файл

{%- from "salt/map.jinja" import minion with context -%} {%- from "salt/map.jinja" import minion with context -%}
{%- if minion.env_vars.variables is defined -%} {%- if minion.env_vars.variables is defined -%}
{%- for envvar_name, envvar_value in minion.env_vars.get('variables', {}).iteritems() %}
{%- for envvar_name, envvar_value in minion.env_vars.get('variables', {}).items() %}
export {{ envvar_name }}={% if envvar_value is string -%}{{ envvar_value }}{%- else -%}{{ envvar_value|join(',') }} export {{ envvar_name }}={% if envvar_value is string -%}{{ envvar_value }}{%- else -%}{{ envvar_value|join(',') }}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}

+ 1
- 1
salt/files/map Переглянути файл



{%- set cluster = salt['pillar.get']('salt:control:cluster:'+cluster_name) %} {%- set cluster = salt['pillar.get']('salt:control:cluster:'+cluster_name) %}


{%- for node_name, node in cluster.node.iteritems() %}
{%- for node_name, node in cluster.node.items() %}
{{ node_name }}.{{ cluster.domain }}: {{ node_name }}.{{ cluster.domain }}:
- {{ node_name }}.{{ cluster.domain }} - {{ node_name }}.{{ cluster.domain }}
{%- endfor %} {%- endfor %}

+ 5
- 5
salt/files/master.conf Переглянути файл

{%- if fsparams.get('enabled', False) %} {%- if fsparams.get('enabled', False) %}
{%- if fsparams.params is defined %} {%- if fsparams.params is defined %}
- {{ fsparams.url }}: - {{ fsparams.url }}:
{%- for key, value in fsparams.params.iteritems() %}
{%- for key, value in fsparams.params.items() %}
- {{ key }}: {{ value }} - {{ key }}: {{ value }}
{%- endfor %} {%- endfor %}
{%- else %} {%- else %}
file_roots: file_roots:
base: base:
- {{ master.dir.files }}/{{ master.system.environment }} - {{ master.dir.files }}/{{ master.system.environment }}
{%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
{%- for formula_name, formula in master.system.get('formula', {}).items() %}
- {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }} - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
{%- endfor %} {%- endfor %}
{{ master.system.environment }}: {{ master.system.environment }}:
- {{ master.dir.files }}/{{ master.system.environment }} - {{ master.dir.files }}/{{ master.system.environment }}
{%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
{%- for formula_name, formula in master.system.get('formula', {}).items() %}
- {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }} - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
{%- endfor %} {%- endfor %}


{%- else %} {%- else %}


file_roots: file_roots:
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}
{%- if master.base_environment == environment_name %} {%- if master.base_environment == environment_name %}
base: base:
- {{ master.dir.files }}/{{ environment_name }} - {{ master.dir.files }}/{{ environment_name }}
{# NONE: Might be rewritten, once proved to work properly, with filters: #} {# NONE: Might be rewritten, once proved to work properly, with filters: #}
{# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #} {# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #}
{%- set ext_engines = {} %} {%- set ext_engines = {} %}
{%- for name,engine in master.pillar.iteritems() %}
{%- for name,engine in master.pillar.items() %}
{%- if not engine is mapping %}{% continue %}{% endif %} {%- if not engine is mapping %}{% continue %}{% endif %}
{%- do engine.update({'name': engine.get('name', name) }) %} {%- do engine.update({'name': engine.get('name', name) }) %}
{%- set index = engine.get('index', '1')~'-'~name %} {%- set index = engine.get('index', '1')~'-'~name %}

+ 2
- 2
salt/files/minion.conf Переглянути файл

roles: roles:
{%- for key, value in pillar.items() %} {%- for key, value in pillar.items() %}
{%- if key not in excluded_keys %} {%- if key not in excluded_keys %}
{%- for subkey, subvalue in value.iteritems() %}
{%- for subkey, subvalue in value.items() %}
{%- if subvalue.enabled is defined and subvalue.enabled %} {%- if subvalue.enabled is defined and subvalue.enabled %}
- {{key}}.{{ subkey }} - {{key}}.{{ subkey }}
{%- endif %} {%- endif %}
{%- if minion.mine is defined %} {%- if minion.mine is defined %}


mine_functions: mine_functions:
{%- for salt_module, salt_functions in minion.mine.module.iteritems() %}
{%- for salt_module, salt_functions in minion.mine.module.items() %}
{{ salt_module }}: {{ salt_functions }} {{ salt_module }}: {{ salt_functions }}
{%- endfor %} {%- endfor %}
mine_interval: {{ minion.mine.get('interval', 30) }} mine_interval: {{ minion.mine.get('interval', 30) }}

+ 1
- 1
salt/files/orchestrate.sls Переглянути файл

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


{%- if master.enabled %} {%- if master.enabled %}
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}
{%- if master.base_environment == environment_name %} {%- if master.base_environment == environment_name %}
{%- set sorted_priorities = priorities|dictsort(false, 'value') %} {%- set sorted_priorities = priorities|dictsort(false, 'value') %}
{#- Set debug = True to log simple state result - Fail/True - to /var/log/salt/ on both master and respective minions #} {#- Set debug = True to log simple state result - Fail/True - to /var/log/salt/ on both master and respective minions #}

+ 2
- 2
salt/files/profiles.conf Переглянути файл

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


{%- for cluster_name, cluster in control.cluster.iteritems() %}
{%- for cluster_name, cluster in control.cluster.items() %}


{%- for node_name, node in cluster.node.iteritems() %}
{%- for node_name, node in cluster.node.items() %}


{{ node_name }}.{{ cluster.domain }}: {{ node_name }}.{{ cluster.domain }}:
provider: {{ node.provider }} provider: {{ node.provider }}

+ 1
- 1
salt/files/providers.conf Переглянути файл

{% from "salt/map.jinja" import control with context %} {% from "salt/map.jinja" import control with context %}
{%- for provider_name, provider in control.provider.iteritems() %}
{%- for provider_name, provider in control.provider.items() %}


{{ provider_name }}: {{ provider_name }}:
provider: {{ provider.engine }} provider: {{ provider.engine }}

+ 1
- 1
salt/files/roster Переглянути файл

{%- from "salt/map.jinja" import master with context %} {%- from "salt/map.jinja" import master with context %}
{%- for minion_name, minion in master.ssh.get('minion', {}).iteritems() %}
{%- for minion_name, minion in master.ssh.get('minion', {}).items() %}
{{ minion_name }}: {{ minion_name }}:
host: {{ minion.host }} host: {{ minion.host }}
user: {{ minion.user }} user: {{ minion.user }}

+ 5
- 5
salt/files/salt-state-graph.py Переглянути файл



if isinstance(obj, dict): if isinstance(obj, dict):
# a dict - check each key # a dict - check each key
for key, prop in obj.iteritems():
for key, prop in obj.items():
if key == find_key: if key == find_key:
results.extend(prop) results.extend(prop)
else: else:
try: try:
deps = find(states, relname) deps = find(states, relname)
for dep in deps: for dep in deps:
for dep_type, dep_name in dep.iteritems():
for dep_type, dep_name in dep.items():
yield make_node_name(dep_type, dep_name) yield make_node_name(dep_type, dep_name)
except AttributeError as e: except AttributeError as e:
sys.stderr.write("Bad state: {0}\n".format(str(states))) sys.stderr.write("Bad state: {0}\n".format(str(states)))
'watch_in': {'color': 'red', 'reverse': True}, 'watch_in': {'color': 'red', 'reverse': True},
} }


for top_key, props in state_obj.iteritems():
for top_key, props in state_obj.items():
# Add a node for each state type embedded in this state # Add a node for each state type embedded in this state
# keys starting with underscores are not candidates # keys starting with underscores are not candidates


"Removing __extend__ states:\n{0}\n".format(str(props))) "Removing __extend__ states:\n{0}\n".format(str(props)))
continue continue


for top_key_type, states in props.iteritems():
for top_key_type, states in props.items():
if top_key_type[:2] == '__': if top_key_type[:2] == '__':
continue continue


node_name = make_node_name(top_key_type, top_key) node_name = make_node_name(top_key_type, top_key)
graph.add_node(Node(node_name)) graph.add_node(Node(node_name))


for edge_type, ruleset in rules.iteritems():
for edge_type, ruleset in rules.items():
for relname in find_edges(states, edge_type): for relname in find_edges(states, edge_type):
if 'reverse' in ruleset and ruleset['reverse']: if 'reverse' in ruleset and ruleset['reverse']:
graph.add_edge(Edge( graph.add_edge(Edge(

+ 14
- 14
salt/master/env.sls Переглянути файл

- /srv/salt/env/{{ master.system.environment }} - /srv/salt/env/{{ master.system.environment }}
- makedirs: True - makedirs: True


{%- for grain_name, grain in master.system.get('grain', {}).iteritems() %}
{%- for grain_name, grain in master.system.get('grain', {}).items() %}


{%- if grain.source == 'git' %} {%- if grain.source == 'git' %}




{%- endfor %} {%- endfor %}


{%- for state_name, state in master.system.get('state', {}).iteritems() %}
{%- for state_name, state in master.system.get('state', {}).items() %}


{%- if state.source == 'git' %} {%- if state.source == 'git' %}




{%- endfor %} {%- endfor %}


{%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
{%- for formula_name, formula in master.system.get('formula', {}).items() %}


{%- if formula.source == 'git' %} {%- if formula.source == 'git' %}




{# Start new #} {# Start new #}


{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}


{%- if master.base_environment == environment_name %} {%- if master.base_environment == environment_name %}




{%- set _formula_pkgs = [] %} {%- set _formula_pkgs = [] %}
{%- set _formula_pkgs_with_version = [] %} {%- set _formula_pkgs_with_version = [] %}
{%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
{%- for formula_name, formula in environment.get('formula', {}).items() %}
{%- if formula.source == 'pkg' %} {%- if formula.source == 'pkg' %}
{%- if formula.version is defined %} {%- if formula.version is defined %}
{%- do _formula_pkgs_with_version.append(formula) %} {%- do _formula_pkgs_with_version.append(formula) %}


{% endif %} {% endif %}


{%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
{%- for formula_name, formula in environment.get('formula', {}).items() %}


{%- if formula.source == 'git' %} {%- if formula.source == 'git' %}


- force: True - force: True
- makedirs: True - makedirs: True


{%- for grain_name, grain in formula.get('grain', {}).iteritems() %}
{%- for grain_name, grain in formula.get('grain', {}).items() %}


salt_master_{{ environment_name }}_{{ grain_name }}_grain: salt_master_{{ environment_name }}_{{ grain_name }}_grain:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for module_name, module in formula.get('module', {}).iteritems() %}
{%- for module_name, module in formula.get('module', {}).items() %}


salt_master_{{ environment_name }}_{{ module_name }}_module: salt_master_{{ environment_name }}_{{ module_name }}_module:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for state_name, state in formula.get('state', {}).iteritems() %}
{%- for state_name, state in formula.get('state', {}).items() %}


salt_master_{{ environment_name }}_{{ state_name }}_state: salt_master_{{ environment_name }}_{{ state_name }}_state:
file.symlink: file.symlink:
- force: True - force: True
- makedirs: True - makedirs: True


{%- for grain_name, grain in formula.get('grain', {}).iteritems() %}
{%- for grain_name, grain in formula.get('grain', {}).items() %}


salt_master_{{ environment_name }}_{{ grain_name }}_grain: salt_master_{{ environment_name }}_{{ grain_name }}_grain:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for module_name, module in formula.get('module', {}).iteritems() %}
{%- for module_name, module in formula.get('module', {}).items() %}


salt_master_{{ environment_name }}_{{ module_name }}_module: salt_master_{{ environment_name }}_{{ module_name }}_module:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for state_name, state in formula.get('state', {}).iteritems() %}
{%- for state_name, state in formula.get('state', {}).items() %}


salt_master_{{ environment_name }}_{{ state_name }}_state: salt_master_{{ environment_name }}_{{ state_name }}_state:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for engine_name, engine in formula.get('engine', {}).iteritems() %}
{%- for engine_name, engine in formula.get('engine', {}).items() %}


salt_master_{{ environment_name }}_{{ engine_name }}_engine: salt_master_{{ environment_name }}_{{ engine_name }}_engine:
file.symlink: file.symlink:


{%- endfor %} {%- endfor %}


{%- for runner_name, runner in formula.get('runner', {}).iteritems() %}
{%- for runner_name, runner in formula.get('runner', {}).items() %}


salt_master_{{ environment_name }}_{{ runner_name }}_runner: salt_master_{{ environment_name }}_{{ runner_name }}_runner:
file.symlink: file.symlink:

+ 1
- 1
salt/master/minion.sls Переглянути файл

- require: - require:
- {{ master.install_state }} - {{ master.install_state }}


{%- for name, environment in master.environment.iteritems() %}
{%- for name, environment in master.environment.items() %}


/srv/salt/env/{{ name }}/minion_keys: /srv/salt/env/{{ name }}/minion_keys:
file.symlink: file.symlink:

+ 4
- 4
salt/master/orchestrate.sls Переглянути файл

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


{%- if master.enabled %} {%- if master.enabled %}
{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}
{%- if master.base_environment == environment_name %} {%- if master.base_environment == environment_name %}
{%- set priorities = {} %} {%- set priorities = {} %}
{%- set args = {} %} {%- set args = {} %}
{%- set formulas = environment.get('formula', {}) %} {%- set formulas = environment.get('formula', {}) %}


{%- for formula_name, formula in formulas.iteritems() %}
{%- for formula_name, formula in formulas.items() %}
{%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %} {%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %}
{%- set grains_fragment_file = formula_name+'/meta/salt.yml' %} {%- set grains_fragment_file = formula_name+'/meta/salt.yml' %}
{%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %} {%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
{%- set grains_yaml = load_grains_file()|load_yaml %} {%- set grains_yaml = load_grains_file()|load_yaml %}


{%- for state, priority in grains_yaml['orchestrate'].iteritems() %}
{%- for state, priority in grains_yaml['orchestrate'].items() %}
{%- do priorities.update({ formula_name+'.'+state: grains_yaml['orchestrate'][state]['priority'] }) %} {%- do priorities.update({ formula_name+'.'+state: grains_yaml['orchestrate'][state]['priority'] }) %}
{%- set arguments = [] %} {%- set arguments = [] %}


{%- for arg_name, arg_value in grains_yaml['orchestrate'][state].iteritems() %}
{%- for arg_name, arg_value in grains_yaml['orchestrate'][state].items() %}
{%- if 'priority' not in arg_name %} {%- if 'priority' not in arg_name %}
{%- do arguments.append({arg_name: arg_value}) %} {%- do arguments.append({arg_name: arg_value}) %}
{%- endif %} {%- endif %}

+ 3
- 3
salt/master/pillar.sls Переглянути файл



{%- if master.system is defined %} {%- if master.system is defined %}


{%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
{%- for formula_name, formula in master.system.get('formula', {}).items() %}


/srv/salt/reclass/classes/service/{{ formula_name }}: /srv/salt/reclass/classes/service/{{ formula_name }}:
file.symlink: file.symlink:


{%- else %} {%- else %}


{%- for environment_name, environment in master.get('environment', {}).iteritems() %}
{%- for environment_name, environment in master.get('environment', {}).items() %}


{%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
{%- for formula_name, formula in environment.get('formula', {}).items() %}


{%- if environment_name == master.base_environment %} {%- if environment_name == master.base_environment %}



+ 5
- 5
salt/meta/salt.yml Переглянути файл

{%- set ca_key_file = ca.get('ca_key_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.key') %} {%- set ca_key_file = ca.get('ca_key_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.key') %}
{%- set ca_certs_dir = salt['file.dirname'](ca_file) ~ '/certs/' %} {%- set ca_certs_dir = salt['file.dirname'](ca_file) ~ '/certs/' %}


{%- for signing_policy_name, signing_policy in ca.signing_policy.iteritems() %}
{%- for signing_policy_name, signing_policy in ca.signing_policy.items() %}
{{ ca_name }}_{{ signing_policy_name }}: {{ ca_name }}_{{ signing_policy_name }}:
- minions: '{{ signing_policy.minions }}' - minions: '{{ signing_policy.minions }}'
- signing_private_key: {{ ca_key_file }} - signing_private_key: {{ ca_key_file }}
virt: virt:
{%- if control.net_profile is defined %} {%- if control.net_profile is defined %}
nic: nic:
{%- for item_name, item in control.net_profile.iteritems() %}
{%- for item_name, item in control.net_profile.items() %}
{{ item_name }}: {{ item_name }}:
{%- for iface_name, iface in item.iteritems() %}
{%- for iface_name, iface in item.items() %}
{{ iface_name }}: {{ iface_name }}:
{%- if iface.bridge is defined %} {%- if iface.bridge is defined %}
bridge: {{ iface.bridge }} bridge: {{ iface.bridge }}
{%- endif %} {%- endif %}
{%- if control.disk_profile is defined %} {%- if control.disk_profile is defined %}
disk: disk:
{%- for item_name, item in control.disk_profile.iteritems() %}
{%- for item_name, item in control.disk_profile.items() %}
{{ item_name }}: {{ item_name }}:
{%- for disk_name, disk in item.iteritems() %}
{%- for disk_name, disk in item.items() %}
- {{ disk }}: - {{ disk }}:
{%- if disk.size is defined %} {%- if disk.size is defined %}
size: {{ disk.size }} size: {{ disk.size }}

+ 1
- 1
salt/minion/ca.sls Переглянути файл



{%- set all_ca_certs_dir = '/etc/pki/all_cas' %} {%- set all_ca_certs_dir = '/etc/pki/all_cas' %}


{%- for ca_name,ca in minion.ca.iteritems() %}
{%- for ca_name,ca in minion.ca.items() %}


{%- set ca_file = ca.get('ca_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.crt') %} {%- set ca_file = ca.get('ca_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.crt') %}
{%- set ca_key_file = ca.get('ca_key_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.key') %} {%- set ca_key_file = ca.get('ca_key_file', '/etc/pki/ca/' ~ ca_name ~ '/ca.key') %}

+ 4
- 4
salt/minion/cert.sls Переглянути файл



{%- set created_ca_files = [] %} {%- set created_ca_files = [] %}


{%- for cert_name,cert in minion.get('cert', {}).iteritems() %}
{%- for cert_name,cert in minion.get('cert', {}).items() %}
{%- if cert.get('enabled', True) %} {%- if cert.get('enabled', True) %}
{%- set rowloop = loop %} {%- set rowloop = loop %}


- x509: {{ cert_file }} - x509: {{ cert_file }}


{%- if cert.host is defined and ca_file not in created_ca_files %} {%- if cert.host is defined and ca_file not in created_ca_files %}
{%- for ca_path,ca_cert in salt['mine.get'](cert.host, 'x509.get_pem_entries').get(cert.host, {}).iteritems() %}
{%- for ca_path,ca_cert in salt['mine.get'](cert.host, 'x509.get_pem_entries').get(cert.host, {}).items() %}


{%- if '/etc/pki/all_cas/'+cert.authority in ca_path %} {%- if '/etc/pki/all_cas/'+cert.authority in ca_path %}


{%- if minion.get('trust_salt_ca', True) %} {%- if minion.get('trust_salt_ca', True) %}


{%- for trusted_ca_minion in minion.get('trusted_ca_minions', []) %} {%- for trusted_ca_minion in minion.get('trusted_ca_minions', []) %}
{%- for ca_host, certs in salt['mine.get'](trusted_ca_minion+'*', 'x509.get_pem_entries').iteritems() %}
{%- for ca_path, ca_cert in certs.iteritems() %}
{%- for ca_host, certs in salt['mine.get'](trusted_ca_minion+'*', 'x509.get_pem_entries').items() %}
{%- for ca_path, ca_cert in certs.items() %}
{%- if ca_path.endswith('ca.crt') %} {%- if ca_path.endswith('ca.crt') %}


{# authority name can be obtained only from a cacert path in case of mine.get #} {# authority name can be obtained only from a cacert path in case of mine.get #}

+ 1
- 1
salt/minion/grains.sls Переглянути файл

{%- set support_yaml = load_support_file()|load_yaml %} {%- set support_yaml = load_support_file()|load_yaml %}


{%- if support_yaml and support_yaml.get('grain', {}) %} {%- if support_yaml and support_yaml.get('grain', {}) %}
{%- for name, grain in support_yaml.get('grain', {}).iteritems() %}
{%- for name, grain in support_yaml.get('grain', {}).items() %}
salt_minion_grain_{{ service_name }}_{{ name }}: salt_minion_grain_{{ service_name }}_{{ name }}:
file.managed: file.managed:
- name: /etc/salt/grains.d/{{ name }} - name: /etc/salt/grains.d/{{ name }}

+ 2
- 2
salt/minion/proxy.sls Переглянути файл



{%- set napalm = false %} {%- set napalm = false %}


{%- for proxy_name, proxy_device in proxy_minion.get('device', {}).iteritems() %}
{%- for proxy_name, proxy_device in proxy_minion.get('device', {}).items() %}


{%- if proxy_device.engine == 'napalm' %} {%- if proxy_device.engine == 'napalm' %}




{%- endif %} {%- endif %}


{%- for proxy_name, proxy_device in proxy_minion.get('device', {}).iteritems() %}
{%- for proxy_name, proxy_device in proxy_minion.get('device', {}).items() %}


salt_proxy_{{ proxy_name }}_service: salt_proxy_{{ proxy_name }}_service:
service.running: service.running:

+ 1
- 1
salt/minion/service.sls Переглянути файл

{%- set support_yaml = load_support_file()|load_yaml %} {%- set support_yaml = load_support_file()|load_yaml %}


{%- if support_yaml and support_yaml.get('minion', {}) %} {%- if support_yaml and support_yaml.get('minion', {}) %}
{%- for name, conf in support_yaml.get('minion', {}).iteritems() %}
{%- for name, conf in support_yaml.get('minion', {}).items() %}
salt_minion_config_{{ service_name }}_{{ name }}: salt_minion_config_{{ service_name }}_{{ name }}:
file.managed: file.managed:
- name: /etc/salt/minion.d/_{{ name }}.conf - name: /etc/salt/minion.d/_{{ name }}.conf

Завантаження…
Відмінити
Зберегти