Change-Id: I07e86cb5d132a83b2460deda08b8a7e65f379d33pull/56/head
salt-call event.send 'salt/minion/install' | salt-call event.send 'salt/minion/install' | ||||
Run any orchestration pipeline | |||||
Run any defined orchestration pipeline | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
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 after start | |||||
Add and/or remove the minion key | |||||
.. code-block:: yaml | .. code-block:: yaml | ||||
salt: | salt: | ||||
master: | master: | ||||
reactor: | reactor: | ||||
reclass/minion/classify: | |||||
- salt://reclass/reactor/node_register.sls | |||||
salt/key/create: | |||||
- salt://salt/reactor/key_create.sls | |||||
salt/key/remove: | |||||
- salt://salt/reactor/key_remove.sls | |||||
Event to trigger the node classification | |||||
Event to trigger the key creation | |||||
.. code-block:: bash | .. code-block:: bash | ||||
salt-call event.send 'reclass/minion/classify' "{'node_master_ip': '$config_host', 'node_ip': '${node_ip}', 'node_domain': '$node_domain', 'node_cluster': '$node_cluster', 'node_hostname': '$node_hostname', 'node_os': '$node_os'}" | |||||
salt-call event.send 'salt/key/create' "{'node_name': 'id-of-minion', 'orch_post_create': 'kubernetes/orchestrate/compute_install.sls'}" | |||||
.. note:: | |||||
You can add pass additional `orch_pre_create`, `orch_post_create`, | |||||
`orch_pre_remove` or `orch_post_remove` parameters to the event to call | |||||
extra orchestrate files. This can be useful for example for | |||||
registering/unregistering nodes from the monitoring alarms or dashboards. | |||||
The key creation event needs to be run from other machine than the one | |||||
being registered. | |||||
Event to trigger the key removal | |||||
.. code-block:: bash | |||||
salt-call event.send 'salt/key/remove' | |||||
Salt syndic | Salt syndic | ||||
----------- | ----------- |
{%- set node_name = salt['pillar.get']('node_name') %} | |||||
key_create_{{ node_name }}: | |||||
salt.wheel: | |||||
- name: key.gen_accept | |||||
- id_: {{ node_name }} |
{%- set node_name = salt['pillar.get']('node_name') %} | |||||
key_create_{{ node_name }}: | |||||
salt.wheel: | |||||
- name: key.delete | |||||
- match: {{ node_name }} |
linux_state: | linux_state: | ||||
salt.state: | salt.state: | ||||
- tgt: '{{ node_name }}' | |||||
- sls: linux | |||||
- queue: True | |||||
- tgt: '{{ node_name }}' | |||||
- sls: linux | |||||
- queue: True | |||||
salt_state: | salt_state: | ||||
salt.state: | salt.state: | ||||
- tgt: '{{ node_name }}' | |||||
- sls: salt.minion | |||||
- queue: True | |||||
- require: | |||||
- salt: linux_state | |||||
- tgt: '{{ node_name }}' | |||||
- sls: salt.minion | |||||
- queue: True | |||||
- require: | |||||
- salt: linux_state | |||||
misc_states: | misc_states: | ||||
salt.state: | salt.state: | ||||
- tgt: '{{ node_name }}' | |||||
- sls: ntp,openssh | |||||
- queue: True | |||||
- require: | |||||
- salt: salt_state | |||||
- tgt: '{{ node_name }}' | |||||
- sls: ntp,openssh | |||||
- queue: True | |||||
- require: | |||||
- salt: salt_state |
orchestrate_infra_install: | orchestrate_infra_install: | ||||
runner.state.orchestrate: | runner.state.orchestrate: | ||||
- mods: salt://salt/orchestrate/infra_install.sls | |||||
- queue: True | |||||
- mods: salt://salt/orchestrate/infra_install.sls | |||||
- queue: True |
{% if data.data.orch_pre_create is defined %} | |||||
orchestrate_node_key_pre_create: | |||||
runner.state.orchestrate: | |||||
- mods: salt://{{ data.data.orch_pre_create }} | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% endif %} | |||||
node_key_create: | |||||
runner.state.orchestrate: | |||||
- mods: salt://salt/orchestrate/key_create.sls | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% if data.data.orch_post_create is defined %} | |||||
orchestrate_node_key_post_create: | |||||
runner.state.orchestrate: | |||||
- mods: salt://{{ data.data.orch_post_create }} | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% endif %} |
{% if data.data.orch_pre_remove is defined %} | |||||
orchestrate_node_key_pre_remove: | |||||
runner.state.orchestrate: | |||||
- mods: salt://{{ data.data.orch_pre_remove }} | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% endif %} | |||||
node_key_remove: | |||||
runner.state.orchestrate: | |||||
- mods: salt://salt/orchestrate/key_remove.sls | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% if data.data.orch_post_remove is defined %} | |||||
orchestrate_node_key_post_remove: | |||||
runner.state.orchestrate: | |||||
- mods: salt://{{ data.data.orch_post_remove }} | |||||
- queue: True | |||||
- pillar: | |||||
node_name: {{ data.data['node_name'] }} | |||||
{% endif %} |
orchestrate_node_install: | orchestrate_node_install: | ||||
runner.state.orchestrate: | runner.state.orchestrate: | ||||
- mods: salt://salt/orchestrate/node_install.sls | |||||
- queue: True | |||||
- pillar: | |||||
event_originator: {{ data.id }} | |||||
- mods: salt://salt/orchestrate/node_install.sls | |||||
- queue: True | |||||
- pillar: | |||||
event_originator: {{ data.id }} |
orchestrate_orchestrate_start: | |||||
orchestrate_orchestrate_run: | |||||
runner.state.orchestrate: | runner.state.orchestrate: | ||||
- mods: salt://{{ data.data.orchestrate }} | |||||
- queue: {{ data.data.get('queue', True) }} | |||||
- mods: salt://{{ data.data.orchestrate }} | |||||
- queue: {{ data.data.get('queue', True) }} |