码迷,mamicode.com
首页 > 其他好文 > 详细

Salt架构--Masterless架构

时间:2018-01-29 11:39:47      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:function   mini   tar   oca   spec   log   etc   average   关闭   

没有master的情况下,使用salt,需要关闭salt-minion,使用salt-call命令

[root@linux-node2 ~]# vim /etc/salt/minion
file_client: local
file_roots:
  base:
    - /srv/salt/
pillar_roots:
  base:
    - /srv/pillar
[root@linux-node2 ~]# systemctl stop salt-minion
[root@linux-node2 ~]# salt-call --local cmd.run ‘w‘
local:
     09:42:54 up 23 days,  4:17,  4 users,  load average: 0.42, 0.20, 0.11
    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
    www      pts/0    linux-node1      Fri09   24:04m  0.01s  0.01s -bash
    root     pts/1    192.168.56.1     15Jan18 24:03m  2.10s  2.10s -bash
    root     pts/2    192.168.56.1     Thu10   22.00s  3.59s  0.19s w
    root     pts/3    192.168.56.1     06Jan18 23:54m  7.69s  0.21s -bash
[root@linux-node2 srv]# mkdir salt pillar
[root@linux-node2 salt]# vim demo.sls 
demo-install:
  pkg.installed:
    - names:
      - screen
      - telnet
      - nmap
[root@linux-node2 salt]# salt-call --local state.sls demo test=True
local:
----------
          ID: demo-install
    Function: pkg.installed
        Name: screen
      Result: True
     Comment: All specified packages are already installed
     Started: 09:46:46.007234
    Duration: 37525.123 ms
     Changes:   
----------
          ID: demo-install
    Function: pkg.installed
        Name: telnet
      Result: None
     Comment: The following packages would be installed/updated: telnet
     Started: 09:47:23.532583
    Duration: 6.755 ms
     Changes:   
----------
          ID: demo-install
    Function: pkg.installed
        Name: nmap
      Result: None
     Comment: The following packages would be installed/updated: nmap
     Started: 09:47:23.539472
    Duration: 5.733 ms
     Changes:   

Summary for local
------------
Succeeded: 3 (unchanged=2)
Failed:    0
------------
Total states run:     3
Total run time:  37.538 s

Salt架构--Masterless架构

标签:function   mini   tar   oca   spec   log   etc   average   关闭   

原文地址:http://blog.51cto.com/jinlong/2066280

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!