Browse Source

Salt reactor features refactoring

Change-Id: Ifac3f5e03099e8190db0a3af62a7be1f762f87be
pull/56/head
Adam Tengler 7 years ago
parent
commit
62188969cc
17 changed files with 66 additions and 32 deletions
  1. +2
    -1
      README.rst
  2. +3
    -0
      _modules/saltkey.py
  3. +0
    -6
      salt/orchestrate/key_create.sls
  4. +0
    -6
      salt/orchestrate/key_remove.sls
  5. +0
    -0
      salt/orchestrate/reactor/infra_install.sls
  6. +13
    -0
      salt/orchestrate/reactor/key_create.sls
  7. +11
    -0
      salt/orchestrate/reactor/key_remove.sls
  8. +1
    -0
      salt/orchestrate/reactor/master_update.sls
  9. +1
    -0
      salt/orchestrate/reactor/node_install.sls
  10. +2
    -1
      salt/reactor/infra_install.sls
  11. +7
    -8
      salt/reactor/key_create.sls
  12. +6
    -8
      salt/reactor/key_remove.sls
  13. +1
    -0
      salt/reactor/minion_start.sls
  14. +2
    -1
      salt/reactor/node_install.sls
  15. +2
    -1
      salt/reactor/orchestrate_start.sls
  16. +9
    -0
      salt/reactor_sls/key_create.sls
  17. +6
    -0
      salt/reactor_sls/key_remove.sls

+ 2
- 1
README.rst View File



.. code-block:: bash .. code-block:: bash


salt-call event.send 'salt/key/create' "{'node_name': 'id-of-minion', 'orch_post_create': 'kubernetes/orchestrate/compute_install.sls'}"
salt-call event.send 'salt/key/create' \
> "{'node_id': 'id-of-minion', 'node_host': '172.16.10.100', 'orch_post_create': 'kubernetes.orchestrate.compute_install', 'post_create_pillar': {'node_name': 'id-of-minion'}}"


.. note:: .. note::



+ 3
- 0
_modules/saltkey.py View File

''' '''
Generates minion keypair, accepts it on master and injects it to minion via SSH. Generates minion keypair, accepts it on master and injects it to minion via SSH.


:param id_: expected minion ID of target node
:param host: IP address or resolvable hostname/FQDN of target node

CLI Examples: CLI Examples:


.. code-block:: bash .. code-block:: bash

+ 0
- 6
salt/orchestrate/key_create.sls View File

{%- set node_name = salt['pillar.get']('node_name') %}

key_create_{{ node_name }}:
salt.wheel:
- name: key.gen_accept
- id_: {{ node_name }}

+ 0
- 6
salt/orchestrate/key_remove.sls View File

{%- set node_name = salt['pillar.get']('node_name') %}

key_create_{{ node_name }}:
salt.wheel:
- name: key.delete
- match: {{ node_name }}

salt/orchestrate/infra_install.sls → salt/orchestrate/reactor/infra_install.sls View File


+ 13
- 0
salt/orchestrate/reactor/key_create.sls View File

{%- set node_id = salt['pillar.get']('node_id') %}
{%- set node_host = salt['pillar.get']('node_host') %}

linux_state_all_nodes:
salt.state:
- tgt: 'salt:master'
- tgt_type: pillar
- sls: salt.reactor_sls.key_create
- queue: True
- pillar:
node_id: {{ node_id }}
node_host: {{ node_host }}


+ 11
- 0
salt/orchestrate/reactor/key_remove.sls View File

{%- set node_id = salt['pillar.get']('node_id') %}

linux_state_all_nodes:
salt.state:
- tgt: 'salt:master'
- tgt_type: pillar
- sls: salt.reactor_sls.key_remove
- queue: True
- pillar:
node_id: {{ node_id }}


salt/orchestrate/master_update.sls → salt/orchestrate/reactor/master_update.sls View File

- queue: True - queue: True
- require: - require:
- salt: salt_state_config_node - salt: salt_state_config_node


salt/orchestrate/node_install.sls → salt/orchestrate/reactor/node_install.sls View File

- queue: True - queue: True
- require: - require:
- salt: salt_state - salt: salt_state


+ 2
- 1
salt/reactor/infra_install.sls View File



orchestrate_infra_install: orchestrate_infra_install:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://salt/orchestrate/infra_install.sls
- mods: salt.orchestrate.reactor.infra_install
- queue: True - queue: True


+ 7
- 8
salt/reactor/key_create.sls View File



orchestrate_node_key_pre_create: orchestrate_node_key_pre_create:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://{{ data.data.orch_pre_create }}
- mods: {{ data.data.orch_pre_create }}
- queue: True - queue: True
- pillar:
node_name: {{ data.data['node_name'] }}
- pillar: {{ data.data.get('orch_pre_create_pillar', {}) }}


{% endif %} {% endif %}


node_key_create: node_key_create:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://salt/orchestrate/key_create.sls
- mods: salt.orchestrate.reactor.key_create
- queue: True - queue: True
- pillar: - pillar:
node_name: {{ data.data['node_name'] }}
node_id: {{ data.data['node_id'] }}
node_host: {{ data.data['node_host'] }}


{% if data.data.orch_post_create is defined %} {% if data.data.orch_post_create is defined %}


orchestrate_node_key_post_create: orchestrate_node_key_post_create:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://{{ data.data.orch_post_create }}
- mods: {{ data.data.orch_post_create }}
- queue: True - queue: True
- pillar:
node_name: {{ data.data['node_name'] }}
- pillar: {{ data.data.get('orch_post_create_pillar', {}) }}


{% endif %} {% endif %}

+ 6
- 8
salt/reactor/key_remove.sls View File



orchestrate_node_key_pre_remove: orchestrate_node_key_pre_remove:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://{{ data.data.orch_pre_remove }}
- mods: {{ data.data.orch_pre_remove }}
- queue: True - queue: True
- pillar:
node_name: {{ data.data['node_name'] }}
- pillar: {{ data.data.get('orch_pre_remove_pillar', {}) }}


{% endif %} {% endif %}


node_key_remove: node_key_remove:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://salt/orchestrate/key_remove.sls
- mods: salt.orchestrate.reactor.key_remove.sls
- queue: True - queue: True
- pillar: - pillar:
node_name: {{ data.data['node_name'] }}
node_id: {{ data.data['node_id'] }}


{% if data.data.orch_post_remove is defined %} {% if data.data.orch_post_remove is defined %}


orchestrate_node_key_post_remove: orchestrate_node_key_post_remove:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://{{ data.data.orch_post_remove }}
- mods: {{ data.data.orch_post_remove }}
- queue: True - queue: True
- pillar:
node_name: {{ data.data['node_name'] }}
- pillar: {{ data.data.get('orch_post_remove_pillar', {}) }}


{% endif %} {% endif %}

+ 1
- 0
salt/reactor/minion_start.sls View File

local.saltutil.refresh_pillar: local.saltutil.refresh_pillar:
- tgt: {{ data.id }} - tgt: {{ data.id }}
- queue: True - queue: True


+ 2
- 1
salt/reactor/node_install.sls View File



orchestrate_node_install: orchestrate_node_install:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://salt/orchestrate/node_install.sls
- mods: salt.reactor.orchestrate.node_install
- queue: True - queue: True
- pillar: - pillar:
event_originator: {{ data.id }} event_originator: {{ data.id }}


+ 2
- 1
salt/reactor/orchestrate_start.sls View File



orchestrate_orchestrate_run: orchestrate_orchestrate_run:
runner.state.orchestrate: runner.state.orchestrate:
- mods: salt://{{ data.data.orchestrate }}
- mods: {{ data.data.orchestrate }}
- queue: {{ data.data.get('queue', True) }} - queue: {{ data.data.get('queue', True) }}


+ 9
- 0
salt/reactor_sls/key_create.sls View File

{%- set node_id = salt['pillar.get']('node_id') %}
{%- set node_host = salt['pillar.get']('node_host') %}

key_create_{{ node_id }}:
module.run:
saltkey.key_create:
- id_: {{ node_id }}
- host: {{ node_host }}


+ 6
- 0
salt/reactor_sls/key_remove.sls View File

{%- set node_id = salt['pillar.get']('node_id') %}

key_create_{{ node_id }}:
salt.wheel:
- name: key.delete
- match: {{ node_id }}

Loading…
Cancel
Save