Added salt-master state
and reactor for rfxcom
This commit is contained in:
parent
ab5a894780
commit
4b9e15a9e5
3
salt-master/files/etc/salt/master.d/reactors.conf
Normal file
3
salt-master/files/etc/salt/master.d/reactors.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
reactor:
|
||||||
|
- 'salt/beacon/*/inotify//dev':
|
||||||
|
- /srv/reactor/device_reactor.sls
|
16
salt-master/files/srv/reactor/device_reactor.sls
Normal file
16
salt-master/files/srv/reactor/device_reactor.sls
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% set label = data['path'].split('/')[-1] -%}
|
||||||
|
{% if label in ['rfxtrx433'] -%}
|
||||||
|
{% if data['change'] == 'IN_CREATE' -%}
|
||||||
|
{% set label = label + '=true' -%}
|
||||||
|
{% else %}
|
||||||
|
{% set label = label +'-' -%}
|
||||||
|
{% endif -%}
|
||||||
|
{% set node = data['id'].split('.')[0] -%}
|
||||||
|
label_k3s_node_{{ node }}:
|
||||||
|
local.state.single:
|
||||||
|
- tgt: masters
|
||||||
|
- tgt_type: nodegroup
|
||||||
|
- args:
|
||||||
|
- fun: cmd.run
|
||||||
|
- name: "kubectl label node {{ node }} {{ label }}"
|
||||||
|
{% endif -%}
|
2
salt-master/init.sls
Normal file
2
salt-master/init.sls
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
include:
|
||||||
|
- salt-master.reactors
|
28
salt-master/reactors.sls
Normal file
28
salt-master/reactors.sls
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Create reactors master configuration:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/salt/master.d/reactors.conf
|
||||||
|
- source: salt://salt-master/files/etc/salt/master.d/reactors.conf
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
||||||
|
|
||||||
|
restart master:
|
||||||
|
service.running:
|
||||||
|
- name: salt-master
|
||||||
|
- onchanges:
|
||||||
|
- file: Create reactors master configuration
|
||||||
|
|
||||||
|
Create reactors directory:
|
||||||
|
file.directory:
|
||||||
|
- name: /srv/reactor
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0755"
|
||||||
|
|
||||||
|
Create rfxcom reactor:
|
||||||
|
file.managed:
|
||||||
|
- name: /srv/reactor/device_reactor.sls
|
||||||
|
- source: salt://salt-master/files/srv/reactor/device_reactor.sls
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
Reference in New Issue
Block a user