标签: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
标签:function mini tar oca spec log etc average 关闭
原文地址:http://blog.51cto.com/jinlong/2066280