Salt架构--Masterless架构

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Salt架构--Masterless架构相关的知识,希望对你有一定的参考价值。

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

[[email protected] ~]# vim /etc/salt/minion
file_client: local
file_roots:
  base:
    - /srv/salt/
pillar_roots:
  base:
    - /srv/pillar
[[email protected] ~]# systemctl stop salt-minion
[[email protected] ~]# 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             [email protected]   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
[[email protected] srv]# mkdir salt pillar
[[email protected] salt]# vim demo.sls 
demo-install:
  pkg.installed:
    - names:
      - screen
      - telnet
      - nmap
[[email protected] 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架构的主要内容,如果未能解决你的问题,请参考以下文章

salt-syndic分布式架构

salt-syndic分布式架构

saltstacksaltstack之job返回数据salt-sshsalt-syndic分布式架构salt-api部署

架构丰富的代码片段也应该用于产品列表吗?

SaltStck无Master和多Master架构

巧用Salt,实现CMDB配置自动发现