Explorar el Código

Orchestrates and reactors

Change-Id: I9e48e113656dd9f1ce644e98650276b36e444009
pull/53/head
Ales Komarek hace 7 años
padre
commit
e7844d1043
Se han modificado 7 ficheros con 96 adiciones y 30 borrados
  1. +23
    -7
      README.rst
  2. +14
    -23
      salt/orchestrate/infra_install.sls
  3. +16
    -0
      salt/orchestrate/master_update.sls
  4. +23
    -0
      salt/orchestrate/node_install.sls
  5. +5
    -0
      salt/reactor/infra_install.sls
  6. +7
    -0
      salt/reactor/node_install.sls
  7. +8
    -0
      salt/reactor/node_start.sls

+ 23
- 7
README.rst Ver fichero

@@ -163,7 +163,7 @@ Configure verbosity of state output (used for `salt` command)
master:
state_output: changes

Salt Reactor system sample
Salt synchronise node pillar and modules after start

.. code-block:: yaml

@@ -171,9 +171,25 @@ Salt Reactor system sample
master:
reactor:
salt/minion/*/start:
- salt://reactor/minion-started.sls
- salt://salt/reactor/node_start.sls

Run any orchestration pipeline from custom event
Trigger basic node install

.. code-block:: yaml

salt:
master:
reactor:
salt/minion/install:
- salt://salt/reactor/node_install.sls

Sample event to trigger the node installation

.. code-block:: bash

salt-call event.send 'salt/minion/install'

Run any orchestration pipeline

.. code-block:: yaml

@@ -183,13 +199,13 @@ Run any orchestration pipeline from custom event
salt/orchestrate/start:
- salt://salt/reactor/orchestrate_start.sls

Sample event to trigger the basic orchestration pipeline
Event to trigger the orchestration pipeline

.. code-block:: bash

salt-call event.send 'salt/orchestrate/start' "{'orchestrate': 'salt/orchestrate/infra_install.sls'}
salt-call event.send 'salt/orchestrate/start' "{'orchestrate': 'salt/orchestrate/infra_install.sls'}"

Classify node from custom event
Classify node after start

.. code-block:: yaml

@@ -199,7 +215,7 @@ Classify node from custom event
reclass/minion/classify:
- salt://reclass/reactor/node_register.sls

Sample event to trigger the classification
Event to trigger the node classification

.. code-block:: bash


+ 14
- 23
salt/orchestrate/infra_install.sls Ver fichero

@@ -1,28 +1,10 @@

salt_state_config_node:
salt.state:
- tgt: 'salt:master'
- tgt_type: pillar
- sls: salt.master
- queue: True

reclass_state_config_nodes
salt.state:
- tgt: 'reclass:storage'
- tgt_type: pillar
- sls: reclass
- queue: True
- requires:
- salt: salt_state_config_node

linux_state_all_nodes:
salt.state:
- tgt: 'linux:system'
- tgt_type: pillar
- sls: linux
- queue: True
- requires:
- salt: reclass_state_config_nodes

salt_state_all_nodes:
salt.state:
@@ -30,14 +12,23 @@ salt_state_all_nodes:
- tgt_type: pillar
- sls: salt.minion
- queue: True
- requires:
- require:
- salt: linux_state_all_nodes

ntp_ssh_state_all_nodes:
openssh_state_all_nodes:
salt.state:
- tgt: 'salt:minion'
- tgt: 'openssh:server'
- tgt_type: pillar
- sls: openssh
- queue: True
- require:
- salt: salt_state_all_nodes

ntp_state_all_nodes:
salt.state:
- tgt: 'ntp:client'
- tgt_type: pillar
- sls: ntp,openssh
- sls: ntp
- queue: True
- requires:
- require:
- salt: salt_state_all_nodes

+ 16
- 0
salt/orchestrate/master_update.sls Ver fichero

@@ -0,0 +1,16 @@

salt_state_config_node:
salt.state:
- tgt: 'salt:master'
- tgt_type: pillar
- sls: salt.master
- queue: True

reclass_state_config_nodes
salt.state:
- tgt: 'reclass:storage'
- tgt_type: pillar
- sls: reclass
- queue: True
- require:
- salt: salt_state_config_node

+ 23
- 0
salt/orchestrate/node_install.sls Ver fichero

@@ -0,0 +1,23 @@
{%- set node_name = salt['pillar.get']('event_originator') %}

linux_state:
salt.state:
- tgt: '{{ node_name }}'
- sls: linux
- queue: True

salt_state:
salt.state:
- tgt: '{{ node_name }}'
- sls: salt.minion
- queue: True
- require:
- salt: linux_state

misc_states:
salt.state:
- tgt: '{{ node_name }}'
- sls: ntp,openssh
- queue: True
- require:
- salt: salt_state

+ 5
- 0
salt/reactor/infra_install.sls Ver fichero

@@ -0,0 +1,5 @@

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

+ 7
- 0
salt/reactor/node_install.sls Ver fichero

@@ -0,0 +1,7 @@

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

+ 8
- 0
salt/reactor/node_start.sls Ver fichero

@@ -0,0 +1,8 @@

node_sync_all:
local.saltutil.sync_all:
- tgt: {{ data.id }}

node_refresh_pillar:
local.saltutil.refresh_pillar:
- tgt: {{ data.id }}

Cargando…
Cancelar
Guardar