加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

saltstack常用操作(六)------reactor和event系统

发布时间:2020-12-15 06:44:41 所属栏目:百科 来源:网络整理
导读:0. 简介 学习如何利用事件和salt reactor 使你的基础设施具有反应性和自愈性 1. salt event system event.send模块: salt ‘*’ sys.doc event.send CLI; salt-call event.send ‘salt/mytag’ 2. reactor 对于自定义事件标签的响应: 在master配置文件下

0. 简介

学习如何利用事件和salt reactor 使你的基础设施具有反应性和自愈性

1. salt event system

event.send模块:
salt ‘*’ sys.doc event.send

CLI;
salt-call event.send ‘salt/mytag’

2. reactor

对于自定义事件标签的响应:
在master配置文件下创建reactor配置文件:

reactor:
  - 'salt/mytag':     - salt://reactor_exec.sls 

salt://对应的目录为:/srv/salt/目录,也可以写成绝对路径。
在该目录下创建对应的reactor_exec.sls文件:
响应的事件的行为均在该文件中定义:

remove_marker:
  local.cmd.run:
    - tgt: '*'     - arg:         - 'rm /tmp/marker' init_tag:
  local.state.apply:
    - arg:       - init.event     - tgt: {{ data['id'] }} 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读