15468 发表于 2018-8-1 06:00:04

saltstack 测试

  salt-key -L
  589salt-key -a 192.168.100.231
  590salt-key -L
  591salt '*' test.ping
  592salt '*' cmd.run 'echo helloworld'
  593salt '*' grains.items
  594salt '*' grains.gethwaddr_interfaces
  595salt '*' grains.gethwaddr_interfaces:eth1
  596salt '*' grains.get ip_interfaces:eth1
  597salt '*' grains.get ip_interfaces
  598salt '*' grains.get ip_interfaces:eth1
  599salt '*' grains.get ip_interfaces:eth1:0
  600salt '*' pillar.items
  601salt '*' pillar.get master:ip
  602ifconfig
  603vi /etc/salt/master
  604mkdir -p /srv/pillar
  605cd /srv/pillar
  606salt '*' pillar.items
  607salt '*' pillar.get master:interface
  608rz
  609sz
  610pwd
  611vi package.sls
  612cat package.sls
  613vi top.sls
  614ll
  615cat top.sls
  616salt '*' saltutil.refresh_pillar
  617salt '*' grains.get os
  618ls
  619vi package.sls
  620salt '*' saltutil.refresh_pillar
  621salt '*' pillar.get apache
  622vi /etc/salt/master
  623salt -G 'os:CentOS' test.ping
  624salt-G 'G@os:CentOS' test.ping
  625salt-key -L
  626salt-key -E '192.168.100.(231,232)' test.ping
  627salt -E '192.168.100.(231,232)' test.ping
  628salt -E '192.168.100.(231|232)' test.ping
  629salt -G 'os:Centos' test.ping
  630cd /srv/salt
  631cd /srv/pillar/
  632ll
  633salt-key -L
  634service iptables stop
  635salt-key -L
  636ifconfig
  637salt-key -L
  638salt-key -a 192.168.101.40
  639ls
  640vi web.sls
  641ll
  642vi package.sls
  643ll
  644vi top.sls
  645salt '*' saltutil.refresh_pillar
  646salt '192.168.101.40' pillar.items
  647ls
  648vi top.sls
  649ls
  650vi top.sls
  651salt '*' saltutil.refresh_pillar
  652salt '192.168.101.40' pillar.items
  653vi top.sls
  654ll
  655pwd
  656ll
  657vi top.sls
  658salt '192.168.101.40' pillar.items
  659salt '*' saltutil.refresh_pillar
  660salt '192.168.101.40' pillar.items
  661salt -I 'role:web' test.ping
  662salt -I 'role:web' pkg.install httpd
  663vi /etc/salt/master
  664cd /etc/salt/
  665ll
  666cd master
  667ll\
  668pwd
  669mkdir master.d
  670cd master.d
  671ll
  672vim nodegroup.conf
  673salt -N 'test-cluster' test.ping
  674salt -N 'prod-cluster' test.ping
  675salt -C 'G@os:CentOS and I@role:web' test.ping
  676salt '*' -b 1 test.ping
  677salt-run job.listjobs
  678salt-run jobs.listjobs
  679salt-run jobs.list_jobs
  680salt-run jobs.lookup_jid 20151121172817310598
  681pwd
  682vi /etc/salt/master
  683cd /srv/salt
  684mkdir -p /srv/salt
  685ll
  686cd /srv/salt
  687ll
  688echo "test" > test.txt
  689salt '192.168.101.40' cp.get_file salt://test.txt /tmp/test.txt
  690cd /tmp
  691ll
  692echo "test2" > test2.txt
  693salt-cp '192.168.101.40'/tmp/test2.txt/tmp/test2.txt
  694salt '192.168.101.40' service.start httpd
  695salt '192.168.101.40' service.stop httpd
页: [1]
查看完整版本: saltstack 测试