Saltstack 自动化管理基础篇(一)

      Saltstack是一个新的基础设施管理工具。目前处于快速发展阶段,可以看做是强化的Func+弱化的Puppet的组合。间接的反映出了saltstack的两大功能:远程执行和配置管理。      

     SaltStack保持了输入、输出、配置文件的一致性,所有文件均使用YAML格式。主要负责配置管理和远程执行(在远程主机运行预定 义或任意的命令,也叫远程执行,这是Salt的核心功能。接下来的链接展示了模块(module)和返回器(returner),这是远程执行的关键所 在。)

     Salt是基于python写的经典C/S框架的自动化部署平台。由Master和Minion构成,通过ZeroMQ进行通信。

Master与Minion认证

1.minion 在第一次启动时,会在/etc/salt/pki/minion/(该路径在/etc/salt/minion里面设置)下自动生成 minion.pem(private key)和minion.pub(public key),然后将minion.pub发送给master。

2.master 在接收到minion的public key后,通过salt-key命令accept minion public key,这样在master的/etc/salt/pki/master/minions下的将会存放以minion id命名的public key, 然后master就能对minion发送指令了。

Master与Minion的连接

Saltstack master启动后默认监听4505和4506两个端口。4505(publish_port)为salt的消息发布系统,4506(ret_port) 为salt客户端与服务端通信的端口。如果使用lsof查看4505端口,会发现所有的Minion在4505端口持续保持在ESTABLISHED

参考文档:

http://blog.javachen.com/2013/11/18/study-note-of-saltstack/   经典搭建框架
http://www.linuxyw.com/179.html                                                  salt搭建参考
http://blog.halfss.com/blog/2013/05/22/yun-wei-zi-dong-hua-zhi-saltxue-xi-bi-ji/


salt的安装:
master端:

#yum install salt-master -y                         salt主控端安装
# vim /etc/salt/master                                salt主配置文件修改

interface: 服务监听IP
auto_accept: True(可选,key通过‘salt-key -a keyname’命令手动进行认证)
注意:keyname 就是客户端中设置的id标识(可以查看salt-minion端的配置)

#salt-master -l debug                                   debug模式,查看salt都进行哪些操作
#/etc/init.d/salt-master restart                     重启salt服务
#/etc/init.d/salt-master status                      查看状态
#netstat -antlp | grep 4505                            确保消息发布端口正常
#netstat -antlp | grep 4506                            确保客户端与服务端通信端口正常
#/etc/init.d/salt-master restart 
# /etc/init.d/salt-master status 
# salt-key                                                      查看认证相关信息
# salt-key -a wy-pe2                                     手动添加认证key(给wy-pe2主机添加认证)
#iptables -F                                                   关闭防火墙以免影响认证
#salt-key -a wy-pe2
#salt-key -L                                                   查看认证信息(会有显示已经认证和未认证的相关信息)


[root@wy-pe1 ~]# salt-key -L
Accepted Keys:
wy-pe2                                                                已经允许的key(表示wy-pe2已经允许认证了)
Unaccepted Keys:
Rejected Keys:

#cd /etc/salt/pki/master/minions                            在master中的minions目录中生成认证的key
#setenforce 0                                                            暂时关闭selinux
#/etc/init.d/salt-master restart

执行远程命令(使用salt内建的模块):
#salt 'wy-pe2' test.ping                                            测试master和minion进行通信(在master端进行ping响应测试)
[root@wy-pe1 ~]# salt 'wy-pe2' test.ping                如果能ping通,则为True
wy-pe2:
    True

#lsof -i:4505                                                               查看到minion端都和4505保持建立
[root@wy-pe1 ~]# lsof -i:4505
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
salt-mast 8568 root   12u  IPv4  63217      0t0  TCP *:4505 (LISTEN)
salt-mast 8568 root   14u  IPv4  65101      0t0  TCP wy-pe1:4505->wy-pe2:51237 (ESTABLISHED)(表示建立连接了)
注意:如果认证那块没做好,就会影响相关的链接



客户端安装:
minion端安装配置:
#yum install salt-minion -y
#vim /etc/salt/minion                                                修改minion客户端主配置

master: 服务端主机名
id: 客户端主机名(其实也就是认证key的名字)                用来和master进行认证


#/etc/init.d/salt-minion restart                             重启服务
#cd /etc/salt/pki/minion/                                    在这个目录底下会生成两个认证文件(minion.pub minion.pem)

salt-minion端不能正常启动的解决步骤:(一般就是iptables和selinux的影响
#/etc/init.d/salt-minion restart 
# tail -f /var/log/messages
#/etc/init.d/salt-minion restart
#iptables -F
#tail -f /var/log/salt/minion
#salt-minion -l debug
#setenforce 0
#/etc/init.d/salt-minion restart  
 

安装完毕,在master和minion认证完毕之后会在minion主机上的/etc/salt/pki/minion/目录底下生成新的minion_master.pub

问题1:档master和minion进行认证的时候,master没有接收到public key(minion)
(这个在后来的链接过程中会造成master和minion不能链接)

问题2:辅机salt-minion总是在查看服务状态的时候显示失败(but pid exits!)
# salt-minion -l debug 查看salt客户端详细信息

salt的简单使用:
salt可以直接让minion执行模块命令,也可以直接执行shell命令
1.salt -C ‘wy-pe1 and wy-pe2 or wy-peN’ test.ping        -C表示多参数(表示在测试多台主机的存活状态)
# salt '*' disk.usage                                                                查看磁盘使用情况(使用内建模块查看所有minion端的磁盘使用情况)
#salt '*' cmd.run 'df -h'                                                          使用cmd.run直接调用远程shell命令(功能同上)
# salt '*' cmd.run "cat /root/lall"                                            查看客户端主机的/root/lall文件

2.nodegroup对minion进行分组:
nodegroups:
            group1: '[email protected],bar.domain.com,baz.domain.com or bl*.domain.com'
            group2: 'G@os :Debian and foo.domain.com'

            group3:'wy-pe2'
进行分组测试:
# salt -N group3 test.ping
wy-pe2:
    True

3.grains对minion基本信息的管理:

salt 'wy-pe2' grins.ls                                                            查看grains分类
salt 'wy-pe2' grins.items                                                      查看minnon基本信息(硬件参数)

4.pillar对敏感信息的管理,只有匹配到的节点才能获取和使用
默认pillar数据定义文件存储路径:/srv/pillar

状态管理:
1.salt基于minion进行状态的管理(state)
类似于pupet的pp文件功能,salt的state文件扩展文件名为.sls,采用的是和puppet一样的设计思路。即以master
端的文件状态来确定minion端的一些状态信息设置。(安装的软件包,服务的运行状态以及需要同步的文件配置)    
注意:salt默认的根目录在/srv/salt中,如果没有需要进行建立。

top.sls:这个文件类似于puppet的site.pp文件,作为“最高同步”操作的入口文件,执行“最高同步”操作时,将从此sls文件中获取状态对minion进行同步

示例:(注意,salt文件完全采用ymal格式,对代码的缩进有着严格的要求)
#vim /srv/salt/servers_package.sls
httpd:                            项目名
 pkg:                              类型
  - installed                    动作(表示安装httpd包)
 service:
  - running
  - enable:True
vim-enhanced:
 pkg:
  - installed
tomcat环境
openjdk-7-jdk:
  pkg:
    - installed
tomcat7:
  pkg:
    - installed
    - require:
      - pkg: openjdk-7-jdk

# salt 'wy-pe2' state.sls servers_package              按照sls文件中的配置对wy-pe2进行服务配置

管理配置文件
httpd:
  pkg:
    - installed
  file.managed:                                文件管理(文件同步操作)
    - name: /etc/httpd/conf/httpd.conf
    - source: salt://httpd/httpd.conf

# salt 'wy-pe2' state.highstate                                应用修改(给minion永久添加状态)

3.使用salt schedule对minion进行实时更新,让minion自觉的保持某个状态

4.实时管理
有时候我们需要临时的查看某个机器上的某个文件,或者执行某个命令

cmd.run方式:(salt ‘$targeting’ cmd.run '$cmd')用来远程执行shell命令
# salt 'wy-pe2' cmd.run 'ifconfig eth0'           查看某台主机的网络接口

cmd.script方式可以向远程主机执行脚本
#salt '*' cmd.script salt://useradd.sh               向minion主机上执行useradd.sh脚本(salt://是salt的默认发布目录,即/srv/salt)

注意:salt的cmd.script方式执行任务的时候会输出执行结果的stdin、stdout以及PID信息。


pkg.install方式:制定主机安装软件
#salt 'wy-pe2' pkg.install vsftpd                     指定主机安装软件

# salt '*' network.interfaces                            查看远程主机接口

# salt-cp 'wy-pe2' salt-cmd /home/xxb2        复制文件到指定的系统上(当前目录的salt-cmd)
salt是主命令,一般用来执行命令模块。
salt-cp用来复制文件到制定的系统上去
salt-key用来和minion之间进行身份验证
salt-master为服务端的主守护进程用于控制minion
salt-run为前端命令执行

module方式:(模块查看方式#salt '*' sys.doc)
#salt ‘*’ disk.usage                                    查看磁盘使用情况
# salt '*' grains.item os/osrelease/oscodename
# salt '*' user(group).info xxb2
# salt '*' ip.get_interface eth0
#salt '*' lvm.vgdisplay        


salt相关管理命令:
salt-run manage.up                 查看存活的minion
salt-run manage.down            查看死掉的minion
salt-run manage.down removekeys=True    查看down掉的minion,并将其删除
salt-run manage.status            查看minion的相关状态
salt-run manage.versions        查看slat的所有master和minion的版本信息

附录:

salt详细使用命令

        salt '*' acl.delfacl user myuser /tmp/house/kitchen
        salt '*' acl.delfacl default:group mygroup /tmp/house/kitchen
        salt '*' acl.delfacl d:u myuser /tmp/house/kitchen
        salt '*' acl.delfacl g myuser /tmp/house/kitchen /tmp/house/livingroom
        salt '*' acl.getfacl /tmp/house/kitchen
        salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom
        salt '*' acl.addfacl user myuser rwx /tmp/house/kitchen
        salt '*' acl.addfacl default:group mygroup rx /tmp/house/kitchen
        salt '*' acl.addfacl d:u myuser 7 /tmp/house/kitchen
        salt '*' acl.addfacl g mygroup 0 /tmp/house/kitchen /tmp/house/livingroom
        salt '*' acl.version
        salt '*' acl.wipefacls /tmp/house/kitchen
        salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom
        salt '*' aliases.get_target alias
        salt '*' aliases.has_target alias target
        salt '*' aliases.list_aliases
        salt '*' aliases.rm_alias alias
        salt '*' aliases.set_target alias target
        salt '*' alternatives.auto name
        salt '*' alternatives.check_installed name path
        salt '*' alternatives.display editor
        salt '*' alternatives.install editor /usr/bin/editor /usr/bin/emacs23 50
        salt '*' alternatives.remove name path
        salt '*' alternatives.set name path
        salt '*' alternatives.show_current editor
        salt '*' apache.config /etc/httpd/conf.d/ports.conf                 config="[{'Listen': '22'}]"
        salt '*' apache.directives
        salt '*' apache.fullversion
        salt '*' apache.modules
        salt '*' apache.server_status
        salt '*' apache.server_status other-profile
        salt '*' apache.servermods
        salt '*' apache.signal restart
        salt '*' apache.useradd /etc/httpd/htpasswd larry badpassword
        salt '*' apache.useradd /etc/httpd/htpasswd larry badpass opts=ns
        salt '*' apache.userdel /etc/httpd/htpasswd larry
        salt '*' apache.version
            salt '*' archive.gunzip template=jinja /tmp/{{grains.id}}.txt.gz
        salt '*' archive.gunzip /tmp/sourcefile.txt.gz
            salt '*' archive.gzip template=jinja /tmp/{{grains.id}}.txt
        salt '*' archive.gzip /tmp/sourcefile.txt
            salt '*' archive.rar template=jinja /tmp/rarfile.rar '/tmp/sourcefile1,/tmp/{{grains.id}}.txt'
        salt '*' archive.rar /tmp/rarfile.rar /tmp/sourcefile1,/tmp/sourcefile2
            salt '*' archive.tar cjvf /tmp/salt.tar.bz2 {{grains.saltpath}} template=jinja
        salt '*' archive.tar cjvf /tmp/tarfile.tar.bz2 /tmp/file_1,/tmp/file_2
        salt '*' archive.tar xf foo.tar dest=/target/directory
            salt '*' archive.unrar template=jinja /tmp/rarfile.rar /tmp/{{grains.id}}/ excludes=file_1,file_2
        salt '*' archive.unrar /tmp/rarfile.rar /home/strongbad/ excludes=file_1,file_2
            salt '*' archive.unzip template=jinja /tmp/zipfile.zip /tmp/{{grains.id}}/ excludes=file_1,file_2
        salt '*' archive.unzip /tmp/zipfile.zip /home/strongbad/ excludes=file_1,file_2
            salt '*' archive.zip template=jinja /tmp/zipfile.zip /tmp/sourcefile1,/tmp/{{grains.id}}.txt
        salt '*' archive.zip /tmp/zipfile.zip /tmp/sourcefile1,/tmp/sourcefile2
        salt '*' extfs.dump /dev/sda1
        salt '*' blockdev.tune /dev/sda1 read-ahead=1024 read-write=True
        salt '*' blockdev.wipe /dev/sda1
        salt '*' bridge.add br0
        salt '*' bridge.addif br0 eth0
        salt '*' bridge.delete br0
        salt '*' bridge.delif br0 eth0
        salt '*' bridge.find_interfaces eth0 [eth1...]
        salt '*' bridge.interfaces br0
        salt '*' bridge.list
        salt '*' bridge.show
        salt '*' bridge.show br0
        salt '*' bridge.stp br0 enable
        salt '*' bridge.stp br0 disable
        salt '*' bridge.stp bridge0 enable fxp0
        salt '*' bridge.stp bridge0 disable fxp0
        salt '*' buildout.bootstrap /srv/mybuildout
        salt '*' buildout.buildout /srv/mybuildout
        salt '*' buildout.run_buildout /srv/mybuildout
        salt '*' buildout.upgrade_bootstrap /srv/mybuildout
        salt '*' cloud.action start instance=myinstance
        salt '*' cloud.action stop instance=myinstance
        salt '*' cloud.action show_image provider=my-ec2-config             image=ami-1624987f
        salt '*' cloud.destroy myinstance
        salt '*' cloud.full_query
        salt '*' cloud.list_images my-gce-config
        salt '*' cloud.list_locations my-gce-config
        salt '*' cloud.list_sizes my-gce-config
        salt '*' cloud.profile my-gce-config myinstance
        salt '*' cloud.query
        salt '*' cloud.query list_nodes_full
        salt '*' cloud.query list_nodes_select
        salt '*' cloud.select_query
        salt '*' cmd.exec_code ruby 'puts "cheese"'
        salt '*' cmd.has_exec cat
        salt '*' cmd.retcode "file /bin/bash"
        salt '*' cmd.retcode template=jinja "file {{grains.pythonpath[0]}}/python"
        salt '*' cmd.retcode "grep f" stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.run "ls -l | awk '/foo/{print \$2}'"
        salt '*' cmd.run template=jinja "ls -l /tmp/{{grains.id}} | awk '/foo/{print \$2}'"
        salt '*' cmd.run "Get-ChildItem C:\ " shell='powershell'
        salt '*' cmd.run "grep f" stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.run cmd='sed -e s/=/:/g'
        salt '*' cmd.run_all "ls -l | awk '/foo/{print \$2}'"
        salt '*' cmd.run_all template=jinja "ls -l /tmp/{{grains.id}} | awk '/foo/{print \$2}'"
        salt '*' cmd.run_all "grep f" stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.run_chroot /var/lib/lxc/container_name/rootfs 'sh /tmp/bootstrap.sh'
        salt '*' cmd.run_stderr "ls -l | awk '/foo/{print \$2}'"
        salt '*' cmd.run_stderr template=jinja "ls -l /tmp/{{grains.id}} | awk '/foo/{print \$2}'"
        salt '*' cmd.run_stderr "grep f" stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.run_stdout "ls -l | awk '/foo/{print \$2}'"
        salt '*' cmd.run_stdout template=jinja "ls -l /tmp/{{grains.id}} | awk '/foo/{print \$2}'"
        salt '*' cmd.run_stdout "grep f" stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.script salt://scripts/runme.sh
        salt '*' cmd.script salt://scripts/runme.sh 'arg1 arg2 "arg 3"'
        salt '*' cmd.script salt://scripts/windows_task.ps1 args=' -Input c:\tmp\infile.txt' shell='powershell'
        salt '*' cmd.script salt://scripts/runme.sh stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.script_retcode salt://scripts/runme.sh
        salt '*' cmd.script_retcode salt://scripts/runme.sh stdin='one\ntwo\nthree\nfour\nfive\n'
        salt '*' cmd.tty tty0 'This is a test'
        salt '*' cmd.tty pts3 'This is a test'
        salt '*' cmd.which cat
        salt '*' cmd.which_bin '[pip2, pip, pip-python]'
        salt '*' composer.install /var/www/application
        salt '*' composer.install /var/www/application             no_dev=True optimize=True
        salt '*' config.backup_mode
        salt '*' config.dot_vals host
        salt '*' config.get pkg:apache
        salt '*' config.manage_mode
        salt '*' config.merge schedule
        salt '*' config.option redis.host
        salt '*' config.valid_fileproto salt://path/to/file
        salt '*' cp.cache_dir salt://path/to/dir
        salt '*' cp.cache_dir salt://path/to/dir include_pat='E@*.py$'
        salt '*' cp.cache_file salt://path/to/file
        salt '*' cp.cache_files salt://pathto/file1,salt://pathto/file1
        salt '*' cp.cache_local_file /etc/hosts
        salt '*' cp.cache_master
        salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
        salt '*' cp.get_file salt://path/to/file /minion/dest
        salt '*' cp.get_file "salt://{{grains.os}}/vimrc" /etc/vimrc template=jinja
        salt '*' cp.get_file_str salt://my/file
        salt '*' cp.get_template salt://path/to/template /minion/dest
        salt '*' cp.get_url salt://my/file /tmp/mine
        salt '*' cp.get_url http://www.slashdot.org /tmp/index.html
        salt '*' cp.hash_file salt://path/to/file
        salt '*' cp.is_cached salt://path/to/file
        salt '*' cp.list_master
        salt '*' cp.list_master_dirs
        salt '*' cp.list_master_symlinks
        salt '*' cp.list_minion
        salt '*' cp.list_states
        salt '*' cp.push /etc/fstab
        salt '*' cp.push /usr/lib/mysql
        salt '*' cp.push_dir /etc/modprobe.d/ glob='*.conf'
        salt '*' cron.list_tab root
        salt '*' cron.list_tab root
        salt '*' cron.raw_cron root
        salt '*' cron.rm_job root /usr/local/weekly
        salt '*' cron.rm_job root /usr/bin/foo dayweek=1
        salt '*' cron.rm_env root MAILTO
        salt '*' cron.rm_job root /usr/local/weekly
        salt '*' cron.rm_job root /usr/bin/foo dayweek=1
        salt '*' cron.set_env root MAILTO [email protected]
        salt '*' cron.set_job root '*' '*' '*' '*' 1 /usr/local/weekly
        salt '*' cron.set_special root @hourly 'echo foobar'
        salt '*' cron.write_cron_file root /tmp/new_cron
        salt '*' cron.write_cron_file_verbose root /tmp/new_cron
        salt '*' daemontools.available foo
        salt '*' daemontools.full_restart <service name>
        salt '*' daemontools.get_all
        salt '*' daemontools.missing foo
        salt '*' daemontools.reload <service name>
        salt '*' daemontools.restart <service name>
        salt '*' daemontools.start <service name>
        salt '*' daemontools.status <service name>
        salt '*' daemontools.stop <service name>
        salt '*' daemontools.term <service name>
        salt '*' data.cas <key> <value> <old_value>
        salt '*' data.clear
        salt '*' data.dump '{'eggs': 'spam'}'
        salt '*' data.getval <key>
        salt '*' data.getvals <key> [<key> ...]
        salt '*' data.load
        salt '*' data.update <key> <value>
        salt '*' defaults.get core:users:root
        salt '*' disk.blkid
        salt '*' disk.blkid /dev/sda
        salt '*' disk.inodeusage
        salt '*' disk.percent /var
        salt '*' disk.usage
        salt '*' django.collectstatic <settings_module>
        salt '*' django.command <settings_module> <command>
        salt '*' django.createsuperuser <settings_module> user [email protected]
        salt '*' django.loaddata <settings_module> <comma delimited list of fixtures>
        salt '*' django.syncdb <settings_module>
        salt '*' dnsmasq.version
        salt '*' dnsmasq.get_config
        salt '*' dnsmasq.get_config file=/etc/dnsmasq.conf
        salt '*' dnsmasq.set_config domain=mydomain.com
        salt '*' dnsmasq.set_config follow=False domain=mydomain.com
        salt '*' dnsmasq.set_config file=/etc/dnsmasq.conf domain=mydomain.com
        salt '*' dnsmasq.version
        salt '*' dnsutil.hosts_append /etc/hosts 127.0.0.1 ad1.yuk.co,ad2.yuk.co
        salt '*' dnsutil.hosts_remove /etc/hosts ad1.yuk.co
        salt '*' dnsutil.hosts_remove /etc/hosts ad2.yuk.co,ad1.yuk.co
        salt '*' dnsutil.parse_hosts
        salt '*' environ.get foo
        salt '*' environ.get baz default=False
        salt '*' environ.has_value foo
        salt '*' environ.item foo
        salt '*' environ.item '[foo, baz]' default=None
        salt '*' environ.items
        salt '*' environ.setenv '{"foo": "bar", "baz": "quux"}'
        salt '*' environ.setenv '{"a": "b", "c": False}' false_unsets=True
        salt '*' environ.setval foo bar
        salt '*' environ.setval baz val=False false_unsets=True
        salt '*' event.fire '{"data":"my event data"}' 'tag'
        salt '*' event.fire_master '{"data":"my event data"}' 'tag'
        salt '*' extfs.attributes /dev/sda1
        salt '*' extfs.blocks /dev/sda1
        salt '*' extfs.dump /dev/sda1
        salt '*' extfs.mkfs /dev/sda1 fs_type=ext4 opts='acl,noexec'
        salt '*' extfs.tune /dev/sda1 force=True label=wildstallyns opts='acl,noexec'
        salt '*' file.access /path/to/file f
        salt '*' file.access /path/to/file x
        salt '*' file.append /etc/motd \
            salt '*' file.append /etc/motd args='cheese=spam'
            salt '*' file.append /etc/motd args="['cheese=spam','spam=cheese']"
        salt '*' file.blockreplace /etc/hosts '#-- start managed zone foobar : DO NOT EDIT --' \
        salt '*' file.check_file_meta /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' base
        salt '*' file.check_hash /etc/fstab md5:<md5sum>
        salt '*' file.check_managed /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' jinja True None None base
        salt '*' file.check_managed_changes /etc/httpd/conf.d/httpd.conf salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root, root, '755' jinja True None None base
        salt '*' file.check_perms /etc/sudoers '{}' root root 400
        salt '*' file.chgrp /etc/passwd root
        salt '*' file.chown /etc/passwd root root
        salt '*' file.comment /etc/modules pcspkr
        salt '*' file.contains /etc/crontab 'mymaintenance.sh'
        salt '*' file.contains_glob /etc/foobar '*cheese*'
        salt '*' file.contains_regex /etc/crontab
        salt '*' file.contains_regex_multiline /etc/crontab '^maint'
        salt '*' file.copy /path/to/src /path/to/dst
        salt '*' file.copy /path/to/src_dir /path/to/dst_dir recurse=True
        salt '*' file.copy /path/to/src_dir /path/to/dst_dir recurse=True remove_existing=True
        salt '*' file.restore_backup /foo/bar/baz.txt 0
        salt '*' file.directory_exists /etc
        salt '*' file.extract_hash /etc/foo sha512 /path/to/hash/file
        salt '*' file.file_exists /etc/passwd
        salt '*' file.find / type=f name=\*.bak size=+10m
        salt '*' file.find /var mtime=+30d size=+10m print=path,size,mtime
        salt '*' file.find /var/log name=\*.[0-9] mtime=+30d size=+10m delete
       salt '*' file.get_devmm /dev/chr
        salt '*' file.get_diff /home/fred/.vimrc salt://users/fred/.vimrc
        salt '*' file.get_gid /etc/passwd
        salt '*' file.get_group /etc/passwd
        salt '*' file.get_hash /etc/shadow
        salt '*' file.get_managed /etc/httpd/conf.d/httpd.conf jinja salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root root '755' base None None
        salt '*' file.get_mode /etc/passwd
        salt '*' file.get_selinux_context /etc/hosts
        salt '*' file.get_sum /etc/passwd sha512
        salt '*' file.get_uid /etc/passwd
        salt '*' file.get_user /etc/passwd
        salt '*' file.gid_to_group 0
        salt '*' file.grep /etc/passwd nobody
        salt '*' file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr " -i"
        salt '*' file.grep /etc/sysconfig/network-scripts/ifcfg-eth0 ipaddr " -i -B2"
        salt '*' file.grep "/etc/sysconfig/network-scripts/*" ipaddr " -i -l"
        salt '*' file.group_to_gid root
       salt '*' file.is_blkdev /dev/blk
       salt '*' file.is_chrdev /dev/chr
       salt '*' file.is_fifo /dev/fifo
       salt '*' file.is_link /path/to/link
        salt '*' file.join '/' 'usr' 'local' 'bin'
        salt '*' file.chown /etc/passwd root root
        salt '*' file.link /path/to/file /path/to/link
        salt '*' file.list_backups /foo/bar/baz.txt
        salt '*' file.list_backups /foo/bar/baz.txt
        salt '*' file.lstat /path/to/file
        salt '*' file.makedirs /opt/code/
        salt '*' file.makedirs_perms /opt/code
        salt '*' file.manage_file /etc/httpd/conf.d/httpd.conf '' '{}' salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' root root '755' base ''
        salt '*' file.mkdir /opt/jetty/context
      salt '*' file.mknod /dev/chr c 180 31
      salt '*' file.mknod /dev/blk b 8 999
      salt '*' file.nknod /dev/fifo p
       salt '*' file.mknod_blkdev /dev/blk 8 999
       salt '*' file.mknod_chrdev /dev/chr 180 31
       salt '*' file.mknod_fifo /dev/fifo
        salt '*' file.open_files
        salt '*' file.open_files by_pid=True
        salt '*' file.pardir
        salt '*' file.patch /opt/file.txt /tmp/file.txt.patch
        salt '*' file.path_exists_glob /etc/pam*/pass*
        salt '*' file.prepend /etc/motd \
            salt '*' file.prepend /etc/motd args='cheese=spam'
            salt '*' file.prepend /etc/motd args="['cheese=spam','spam=cheese']"
        salt '*' file.sed /etc/httpd/httpd.conf 'LogLevel warn' 'LogLevel info'
        salt '*' file.readdir /path/to/dir/
        salt '*' file.readlink /path/to/link
        salt '*' file.remove /tmp/foo
        salt '*' file.restore_backup /foo/bar/baz.txt 0
        salt '*' file.rename /path/to/src /path/to/dst
        salt '*' file.replace /path/to/file pattern="bind-address\s*=" repl='bind-address:'
        salt '*' file.replace /path/to/file pattern='=' repl=':'
        salt '*' file.replace /etc/httpd/httpd.conf pattern='LogLevel warn' repl='LogLevel info'
        salt '*' file.replace /some/file pattern='before' repl='after' flags='[MULTILINE, IGNORECASE]'
        salt '*' file.restore_backup /foo/bar/baz.txt 0
         salt '*' file.restorecon /home/user/.ssh/authorized_keys
        salt '*' file.rmdir /tmp/foo/
        salt '*' file.search /etc/crontab 'mymaintenance.sh'
        salt '*' file.sed /etc/httpd/httpd.conf 'LogLevel warn' 'LogLevel info'
        salt '*' file.contains /etc/crontab 'mymaintenance.sh'
        salt '*' file.seek_read /path/to/file 4096 0
        salt '*' file.seek_write /path/to/file 'some data' 4096
        salt '*' file.set_mode /etc/passwd 0644
        salt '*' file.set_selinux_context path <role> <type> <range>
        salt '*' file.source_list salt://http/httpd.conf '{hash_type: 'md5', 'hsum': <md5sum>}' base
        salt '*' file.stats /etc/passwd
        salt '*' file.statvfs /path/to/file
        salt '*' file.symlink /path/to/file /path/to/link
        salt '*' file.touch /var/log/emptyfile
        salt '*' file.truncate /path/to/file 512
        salt '*' file.uid_to_user 0
        salt '*' file.uncomment /etc/hosts.deny 'ALL: PARANOID'
        salt '*' file.user_to_uid root
        salt '*' file.write /etc/motd \
            salt '*' file.write /etc/motd args='cheese=spam'
            salt '*' file.write /etc/motd args="['cheese=spam','spam=cheese']"
        salt '*' gem.install vagrant
        salt '*' gem.list
        salt '*' gem.sources_add http://rubygems.org/
        salt '*' gem.sources_list
        salt '*' gem.sources_remove http://rubygems.org/
        salt '*' gem.uninstall vagrant
        salt '*' gem.update vagrant
        salt '*' gem.update_system
        salt '*' grains.append key val
        salt '*' grains.delval key
        salt '*' grains.filter_by '{Debian: Debheads rule, RedHat: I love my hat}'
        salt '*' grains.filter_by '{A: B, C: {D: {E: F,G: H}}}' 'xxx' '{D: {E: I},J: K}' 'C'
        salt '*' grains.get pkg:apache
        salt '*' grains.get_or_set_hash 'django:SECRET_KEY' 50
        salt '*' grains.has_value pkg:apache
        salt '*' grains.item os
        salt '*' grains.item os osrelease oscodename
        salt '*' grains.item host sanitize=True
        salt '*' grains.items
        salt '*' grains.items sanitize=True
        salt '*' grains.ls
        salt '*' grains.remove key val
        salt '*' grains.setval key val
        salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
        salt '*' grains.setvals "{'key1': 'val1', 'key2': 'val2'}"
        salt '*' group.add foo 3456
         salt '*' group.adduser foo bar
        salt '*' group.chgid foo 4376
        salt '*' group.delete foo
         salt '*' group.deluser foo bar
        salt '*' group.getent
        salt '*' group.info foo
        salt '*' group.members foo 'user1,user2,user3,...'
        salt '*' grub.conf
        salt '*' grub.version
        salt '*' hashutil.base64_decodestring 'Z2V0IHNhbHRlZA==
        salt '*' hashutil.base64_encodestring 'get salted'
        salt '*' hashutil.hmac_signature 'get salted' 'shared secret' 'NS2BvKxFRk+rndAlFbCYIFNVkPtI/3KiIYQw4okNKU8='
        salt '*' hashutil.md5_digest 'get salted'
        salt '*' hashutil.sha256_digest 'get salted'
        salt '*' hashutil.sha512_digest 'get salted'
        salt '*' hg.archive /path/to/repo output=/tmp/archive.tgz fmt=tgz
        salt '*' hg.clone /path/to/repo https://bitbucket.org/birkenfeld/sphinx
        salt '*' hg.describe /path/to/repo
        salt '*' hg.pull /path/to/repo opts=-u
        salt '*' hg.revision /path/to/repo mybranch
        salt '*' hosts.add_host <ip> <alias>
        salt '*' hosts.get_alias <ip addr>
        salt '*' hosts.get_ip <hostname>
        salt '*' hosts.has_pair <ip> <alias>
        salt '*' hosts.list_hosts
        salt '*' hosts.rm_host <ip> <alias>
        salt '*' hosts.set_host <ip> <alias>
        salt '*' img.bootstrap /srv/salt-images/host.qcow 4096 qcow2
        salt '*' img.mount_image /tmp/foo
        salt '*' img.mount_image /tmp/foo
        salt '*' img.umount_image /mnt/foo
        salt '*' incron.list_tab root
        salt '*' incron.list_tab root
        salt '*' incron.raw_cron root
        salt '*' incron.raw_system_cron
        salt '*' incron.rm_job root /path
        salt '*' incron.rm_job root /path
        salt '*' incron.set_job root '/root' 'IN_MODIFY' 'echo "$$ $@ $# $% $&"'
        salt '*' incron.write_incron_file_verbose root /tmp/new_cron
        salt '*' incron.write_cron_file root /tmp/new_cron
        salt '*' ini.get_option /path/to/ini section_name option_name
        salt '*' ini.get_section /path/to/ini section_name
        salt '*' ini.remove_option /path/to/ini section_name option_name
        salt '*' ini.remove_section /path/to/ini section_name
        salt '*' ini.set_option /path/to/ini '{section_foo: {key: value}}'
        salt '*' ip.apply_network_settings
        salt '*' ip.build_bond bond0 mode=balance-alb
        salt '*' ip.build_interface eth0 eth <settings>
        salt '*' ip.build_network_settings <settings>
        salt '*' ip.build_routes eth0 <settings>
        salt '*' ip.down eth0
        salt '*' ip.get_bond bond0
        salt '*' ip.get_interface eth0
        salt '*' ip.get_network_settings
        salt '*' ip.get_routes eth0
        salt '*' ip.up eth0
        salt '*' iptables.append filter INPUT \
        salt '*' iptables.append filter INPUT \
        salt '*' iptables.build_rule match=state \
        salt '*' iptables.build_rule filter INPUT command=I position=3 \
        salt '*' iptables.build_rule filter INPUT command=A \
        salt '*' iptables.build_rule filter INPUT command=A \
        salt '*' iptables.build_rule filter INPUT command=A \
        salt '*' iptables.build_rule match=state \
        salt '*' iptables.build_rule filter INPUT command=I position=3 \
        salt '*' iptables.check filter INPUT \
        salt '*' iptables.check filter INPUT \
        salt '*' iptables.check_chain filter INPUT
        salt '*' iptables.check_chain filter INPUT family=ipv6
        salt '*' iptables.delete filter INPUT position=3
        salt '*' iptables.delete filter INPUT \
        salt '*' iptables.delete filter INPUT position=3 family=ipv6
        salt '*' iptables.delete filter INPUT \
        salt '*' iptables.delete_chain filter CUSTOM_CHAIN
        salt '*' iptables.delete_chain filter CUSTOM_CHAIN family=ipv6
        salt '*' iptables.flush filter INPUT
        salt '*' iptables.flush filter INPUT family=ipv6
        salt '*' iptables.get_policy filter INPUT
        salt '*' iptables.get_policy filter INPUT family=ipv6
        salt '*' iptables.get_rules
        salt '*' iptables.get_rules family=ipv6
        salt '*' iptables.get_saved_policy filter INPUT
        salt '*' iptables.get_saved_policy filter INPUT \
        salt '*' iptables.get_saved_policy filter INPUT family=ipv6
        salt '*' iptables.get_saved_policy filter INPUT \
        salt '*' iptables.get_saved_rules
        salt '*' iptables.get_saved_rules family=ipv6
        salt '*' iptables.insert filter INPUT position=3 \
        salt '*' iptables.insert filter INPUT position=3 \
        salt '*' iptables.new_chain filter CUSTOM_CHAIN
        salt '*' iptables.new_chain filter CUSTOM_CHAIN family=ipv6
        salt '*' iptables.save /etc/sysconfig/iptables
        salt '*' iptables.save /etc/sysconfig/iptables family=ipv6
        salt '*' iptables.set_policy filter INPUT ACCEPT
        salt '*' iptables.set_policy filter INPUT ACCEPT family=ipv6
        salt '*' iptables.version
        salt '*' iptables.version family=ipv6
        salt '*' key.finger
        salt '*' key.finger_master
        salt '*' kmod.available
        salt '*' kmod.check_available kvm
        salt '*' kmod.is_loaded kvm
        salt '*' kmod.load kvm
        salt '*' kmod.lsmod
        salt '*' kmod.mod_list
        salt '*' kmod.remove kvm
        salt '*' locale.avail 'en_US.UTF-8'
        salt '*' locale.gen_locale 'en_US.UTF-8'
        salt '*' locale.get_locale
        salt '*' locale.list_avail
        salt '*' locale.set_locale 'en_US.UTF-8'
        salt '*' locate.locate
        salt '*' locate.stats
        salt '*' locate.updatedb
        salt '*' locate.version
        salt '*' logrotate.set rotate 2
        salt '*' logrotate.set /var/log/wtmp rotate 2
        salt '*' logrotate.show_conf
        salt '*' lowpkg.file_dict httpd
        salt '*' lowpkg.file_dict httpd postfix
        salt '*' lowpkg.file_dict
        salt '*' lowpkg.file_list httpd
        salt '*' lowpkg.file_list httpd postfix
        salt '*' lowpkg.file_list
        salt '*' lowpkg.list_pkgs
        salt '*' lowpkg.verify
        salt '*' lowpkg.verify httpd
        salt '*' lowpkg.verify 'httpd postfix'
        salt '*' lowpkg.verify 'httpd postfix' ignore_types=['config','doc']
        salt '*' lvm.fullversion
        salt '*' lvm.lvcreate new_volume_name vg_name size=10G
        salt '*' lvm.lvcreate new_volume_name vg_name extents=100 /dev/sdb
        salt '*' lvm.lvcreate new_snapshot    vg_name snapshot=volume_name size=3G
        salt '*' lvm.lvdisplay
        salt '*' lvm.lvdisplay /dev/vg_myserver/root
        salt '*' lvm.lvremove lvname vgname force=True
        salt '*' lvm.pvdisplay
        salt '*' lvm.pvdisplay /dev/md0
        salt '*' lvm.version
        salt '*' lvm.vgdisplay
        salt '*' lvm.vgdisplay nova-volumes
        salt '*' match.compound 'L@cheese,foo and *'
        salt '*' match.data 'spam:eggs'
        salt '*' match.filter_by '{foo*: Foo!, bar*: Bar!}' minion_id=bar03
        salt '*' match.glob '*'
        salt '*' match.grain 'os:Ubuntu'
        salt '*' match.grain 'ipv6|2001:db8::ff00:42:8329' delimiter='|'
        salt '*' match.grain_pcre 'os:Fedo.*'
        salt '*' match.grain_pcre 'ipv6|2001:.*' delimiter='|'
        salt '*' match.ipcidr '192.168.44.0/24'
        salt '*' match.list 'server1,server2'
        salt '*' match.pcre '.*'
        salt '*' match.pillar 'cheese:foo'
        salt '*' match.pillar 'clone_url|https://github.com/saltstack/salt.git' delimiter='|'
        salt '*' mine.delete 'network.interfaces'
        salt '*' mine.flush
        salt '*' mine.get '*' network.interfaces
        salt '*' mine.get 'os:Fedora' network.interfaces grain
        salt '*' mine.get 'os:Fedora and [email protected]/24' network.ipaddrs compound
        salt '*' mine.get_docker
        salt '*' mine.get_docker interfaces='eth0'
        salt '*' mine.get_docker interfaces='["eth0", "eth1"]'
        salt '*' mine.get_docker cidrs='107.170.147.0/24'
        salt '*' mine.get_docker cidrs='["107.170.147.0/24", "172.17.42.0/24"]'
        salt '*' mine.get_docker interfaces='["eth0", "eth1"]' cidrs='["107.170.147.0/24", "172.17.42.0/24"]'
        salt '*' mine.send network.interfaces eth0
        salt '*' mine.update
        salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1
        salt '*' modjk.bulk_activate node1,node2,node3 loadbalancer1 other-profile
        salt '*' modjk.bulk_activate ["node1","node2","node3"] loadbalancer1
        salt '*' modjk.bulk_activate ["node1","node2","node3"] loadbalancer1 other-profile
        salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1
        salt '*' modjk.bulk_disable node1,node2,node3 loadbalancer1 other-profile
        salt '*' modjk.bulk_disable ["node1","node2","node3"] loadbalancer1
        salt '*' modjk.bulk_disable ["node1","node2","node3"] loadbalancer1 other-profile
        salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1
        salt '*' modjk.bulk_recover node1,node2,node3 loadbalancer1 other-profile
        salt '*' modjk.bulk_recover ["node1","node2","node3"] loadbalancer1
        salt '*' modjk.bulk_recover ["node1","node2","node3"] loadbalancer1 other-profile
        salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1
        salt '*' modjk.bulk_stop node1,node2,node3 loadbalancer1 other-profile
        salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1
        salt '*' modjk.bulk_stop ["node1","node2","node3"] loadbalancer1 other-profile
        salt '*' modjk.dump_config
        salt '*' modjk.dump_config other-profile
        salt '*' modjk.get_running
        salt '*' modjk.get_running other-profile
        salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}"
        salt '*' modjk.lb_edit loadbalancer1 "{'vlr': 1, 'vlt': 60}" other-profile
        salt '*' modjk.list_configured_members loadbalancer1
        salt '*' modjk.list_configured_members loadbalancer1 other-profile
        salt '*' modjk.recover_all loadbalancer1
        salt '*' modjk.recover_all loadbalancer1 other-profile
        salt '*' modjk.reset_stats loadbalancer1
        salt '*' modjk.reset_stats loadbalancer1 other-profile
        salt '*' modjk.version
        salt '*' modjk.version other-profile
        salt '*' modjk.worker_activate node1 loadbalancer1
        salt '*' modjk.worker_activate node1 loadbalancer1 other-profile
        salt '*' modjk.worker_disable node1 loadbalancer1
        salt '*' modjk.worker_disable node1 loadbalancer1 other-profile
        salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}"
        salt '*' modjk.worker_edit node1 loadbalancer1 "{'vwf': 500, 'vwd': 60}" other-profile
        salt '*' modjk.worker_recover node1 loadbalancer1
        salt '*' modjk.worker_recover node1 loadbalancer1 other-profile
        salt '*' modjk.worker_status node1
        salt '*' modjk.worker_status node1 other-profile
        salt '*' modjk.worker_activate node1 loadbalancer1
        salt '*' modjk.worker_activate node1 loadbalancer1 other-profile
        salt '*' modjk.workers
        salt '*' modjk.workers other-profile
        salt '*' mount.active
        salt '*' mount.fstab
        salt '*' mount.is_fuse_exec sshfs
        salt '*' mount.is_mounted /mnt/share
        salt '*' mount.mount /mnt/foo /dev/sdz1 True
        salt '*' mount.remount /mnt/foo /dev/sdz1 True
        salt '*' mount.rm_fstab /mnt/foo
        salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4
        salt '*' mount.swapoff /root/swapfile
        salt '*' mount.swapon /root/swapfile
        salt '*' mount.swaps
        salt '*' mount.umount /mnt/foo
        salt '*' network.active_tcp
        salt '*' network.arp
        salt '*' network.connect archlinux.org 80
        salt '*' network.connect archlinux.org 80 timeout=3
        salt '*' network.connect archlinux.org 80 timeout=3 family=ipv4
        salt '*' network.connect google-public-dns-a.google.com port=53 proto=udp timeout=3
        salt '*' network.dig archlinux.org
        salt '*' network.get_hostname
        salt '*' network.hw_addr eth0
        salt '*' network.hw_addr eth0
        salt '*' network.in_subnet 10.0.0.0/16
        salt '*' network.interface eth0
        salt '*' network.interface_ip eth0
        salt '*' network.interfaces
        salt '*' network.ip_addrs
        salt '*' network.ip_addrs6
        salt '*' network.ip_addrs
        salt '*' network.ip_addrs6
        salt '*' network.is_loopback 127.0.0.1
        salt '*' network.is_private 10.0.0.3
        salt '*' network.mod_hostname   master.saltstack.com
        salt '*' network.netstat
        salt '*' network.ping archlinux.org
        salt '*' network.subnets
        salt '*' network.traceroute archlinux.org
        salt '*' pillar.items
        salt '*' pillar.ext '{libvirt: _}'
        salt '*' pillar.get pkg:apache
        salt '*' pillar.item foo
        salt '*' pillar.item foo bar baz
        salt '*' pillar.items
        salt '*' pillar.raw
        salt '*' pillar.raw key='roles'
        salt '*' pip.freeze /home/code/path/to/virtualenv/
        salt '*' pip.install <package name>,<package2 name>
        salt '*' pip.install requirements=/path/to/requirements.txt
        salt '*' pip.install <package name> bin_env=/path/to/virtualenv
        salt '*' pip.install <package name> bin_env=/path/to/pip_bin
        salt '*' pip.install markdown,django                 editable=git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed upgrade=True no_deps=True
        salt '*' pip.list salt
        salt '*' pip.uninstall <package name>,<package2 name>
        salt '*' pip.uninstall requirements=/path/to/requirements.txt
        salt '*' pip.uninstall <package name> bin_env=/path/to/virtualenv
        salt '*' pip.uninstall <package name> bin_env=/path/to/pip_bin
        salt '*' pip.version
        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package name> fromrepo=epel-testing
        salt '*' pkg.latest_version <package name> disableexcludes=main
        salt '*' pkg.latest_version <package1> <package2> <package3> ...
        salt '*' pkg.check_db <package1> <package2> <package3>
        salt '*' pkg.check_db <package1> <package2> <package3> fromrepo=epel-testing
        salt '*' pkg.check_db <package1> <package2> <package3> disableexcludes=main
        salt '*' pkg.clean_metadata
        salt '*' pkg.del_repo myrepo
        salt '*' pkg.del_repo myrepo basedir=/path/to/dir
        salt '*' pkg.file_list httpd
        salt '*' pkg.file_list httpd postfix
        salt '*' pkg.file_list
        salt '*' pkg.file_list httpd
        salt '*' pkg.file_list httpd postfix
        salt '*' pkg.file_list
        salt '*' pkg.get_locked_packages
        salt '*' pkg.get_repo myrepo
        salt '*' pkg.get_repo myrepo basedir=/path/to/dir
        salt '*' pkg.group_diff 'Perl Support'
        salt '*' pkg.group_info 'Perl Support'
            salt '*' pkg.group_install 'Group 1'
            salt '*' pkg.group_install 'Group 1,Group 2'
            salt '*' pkg.group_install '["Group 1", "Group 2"]'
            salt '*' pkg.group_install 'My Group' skip='foo,bar'
            salt '*' pkg.group_install 'My Group' skip='["foo", "bar"]'
            salt '*' pkg.group_install 'My Group' include='foo,bar'
            salt '*' pkg.group_install 'My Group' include='["foo", "bar"]'
        salt '*' pkg.group_list
        salt '*' pkg.hold <package name>
        salt '*' pkg.hold pkgs='["foo", "bar"]'
            salt '*' pkg.install <package name>
            salt '*' pkg.install pkgs='["foo", "bar"]'
            salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3-4.el5"}]'
            salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package name> fromrepo=epel-testing
        salt '*' pkg.latest_version <package name> disableexcludes=main
        salt '*' pkg.latest_version <package1> <package2> <package3> ...
        salt '*' pkg.list_pkgs
        salt '*' pkg.list_repo_pkgs
        salt '*' pkg.list_repo_pkgs foo bar baz
        salt '*' pkg.list_repo_pkgs 'samba4*' fromrepo=base,updates
        salt '*' pkg.list_repos
        salt '*' pkg.list_upgrades
        salt '*' pkg.mod_repo reponame enabled=1 gpgcheck=1
        salt '*' pkg.mod_repo reponame basedir=/path/to/dir enabled=1
        salt '*' pkg.mod_repo reponame baseurl= mirrorlist=http://host.com/
        salt '*' pkg.normalize_name zsh.x86_64
        salt '*' pkg.owner /usr/bin/apachectl
        salt '*' pkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
        salt '*' pkg.purge <package name>
        salt '*' pkg.purge <package1>,<package2>,<package3>
        salt '*' pkg.purge pkgs='["foo", "bar"]'
        salt '*' pkg.refresh_db
        salt '*' pkg.remove <package name>
        salt '*' pkg.remove <package1>,<package2>,<package3>
        salt '*' pkg.remove pkgs='["foo", "bar"]'
        salt '*' pkg.unhold <package name>
        salt '*' pkg.unhold pkgs='["foo", "bar"]'
        salt '*' pkg.upgrade
        salt '*' pkg.upgrade_available <package name>
        salt '*' pkg.verify
        salt '*' pkg.verify httpd
        salt '*' pkg.verify 'httpd postfix'
        salt '*' pkg.verify 'httpd postfix' ignore_types=['config','doc']
        salt '*' pkg.version <package name>
        salt '*' pkg.version <package1> <package2> <package3> ...
        salt '*' pkg_resource.add_pkg '{}' bind 9
        salt '*' pkg_resource.check_extra_requirements <pkgname> <extra_requirements>
        salt '*' pkg_resource.pack_sources '[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
        salt '*' pkg_resource.parse_targets
        salt '*' pkg_resource.sort_pkglist '["3.45", "2.13"]'
        salt '*' pkg_resource.stringify 'vim: 7.127'
        salt '*' pkg_resource.version vim
        salt '*' pkg_resource.version foo bar baz
        salt '*' pkg_resource.version 'python*'
        salt '*' pkg_resource.version_clean <version_string>
            salt '*' publish.full_data test.kwarg arg='cheese=spam'
            salt '*' publish.publish test.kwarg arg='cheese=spam'
        salt '*' pyenv.default
        salt '*' pyenv.default 2.0.0-p0
        salt '*' pyenv.do 'gem list bundler'
        salt '*' pyenv.do 'gem list bundler' deploy
        salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler'
        salt '*' pyenv.do_with_python 2.0.0-p0 'gem list bundler' deploy
        salt '*' pyenv.install
        salt '*' pyenv.install_python 2.0.0-p0
        salt '*' pyenv.is_installed
        salt '*' pyenv.list
        salt '*' pyenv.rehash
        salt '*' pyenv.uninstall_python 2.0.0-p0
        salt '*' pyenv.update
        salt '*' pyenv.versions
        salt '*' raid.assemble /dev/md0 ['/dev/xvdd', '/dev/xvde']
        salt '*' raid.create /dev/md0 level=1 chunk=256 devices="['/dev/xvdd', '/dev/xvde']" test_mode=True
            salt '*' raid.detail /dev/md0
        salt '*' raid.destroy /dev/md0
        salt '*' raid.detail '/dev/md0'
        salt '*' raid.list
        salt '*' raid.save_config
        salt '*' random.get_str 128
        salt '*' random.hash 'I am a string' md5
        salt '*' random.shadow_hash 'My5alT' 'MyP@asswd' md5
        salt '*' random.str_encode 'I am a new string' base64
        salt '*' rbenv.default
        salt '*' rbenv.default 2.0.0-p0
        salt '*' rbenv.do 'gem list bundler'
        salt '*' rbenv.do 'gem list bundler' deploy
        salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler'
        salt '*' rbenv.do_with_ruby 2.0.0-p0 'gem list bundler' deploy
        salt '*' rbenv.install
        salt '*' rbenv.install_ruby 2.0.0-p0
        salt '*' rbenv.is_installed
        salt '*' rbenv.list
        salt '*' rbenv.rehash
        salt '*' rbenv.uninstall_ruby 2.0.0-p0
        salt '*' rbenv.update
        salt '*' rbenv.versions
        salt '*' ret.get_fun mysql network.interfaces
        salt '*' ret.get_jid redis 20421104181954700505
        salt '*' ret.get_jids mysql
        salt '*' ret.get_minions mysql
        salt '*' rsync.config
        salt '*' rsync.rsync {src} {dst} {delete=True} {update=True} {passwordfile=/etc/pass.crt} {exclude=xx}
        salt '*' rsync.rsync {src} {dst} {delete=True} {excludefrom=/xx.ini}
        salt '*' rsync.version
        salt '*' rvm.do 2.0.0 <command>
        salt '*' rvm.gemset_copy foobar bazquo
        salt '*' rvm.gemset_create 2.0.0 foobar
        salt '*' rvm.gemset_delete 2.0.0 foobar
        salt '*' rvm.gemset_empty 2.0.0 foobar
        salt '*' rvm.gemset_list
        salt '*' rvm.gemset_list_all
        salt '*' rvm.get
        salt '*' rvm.install
        salt '*' rvm.install_ruby 1.9.3-p385
        salt '*' rvm.is_installed
        salt '*' rvm.list
        salt '*' rvm.reinstall_ruby 1.9.3-p385
        salt '*' rvm.rubygems 2.0.0 1.8.24
        salt '*' rvm.set_default 2.0.0
        salt '*' rvm.wrapper <ruby_string> <wrapper_prefix>
        salt '*' saltutil.clear_cache
        salt '*' saltutil.cmd
        salt '*' saltutil.cmd
        salt '*' saltutil.find_cached_job <job id>
        salt '*' saltutil.find_job <job id>
        salt '*' saltutil.is_running state.highstate
        salt '*' saltutil.kill_job <job id>
        salt '*' saltutil.mmodule base test.ping
        salt '*' saltutil.refresh_modules
        salt '*' saltutil.refresh_pillar
        salt '*' saltutil.regen_keys
        salt '*' saltutil.revoke_auth
        salt '*' saltutil.runner jobs.list_jobs
        salt '*' saltutil.running
        salt '*' saltutil.signal_job <job id> 15
        salt '*' saltutil.sync_all
        salt '*' saltutil.sync_grains
        salt '*' saltutil.sync_modules
        salt '*' saltutil.sync_outputters
        salt '*' saltutil.sync_renderers
        salt '*' saltutil.sync_returners
        salt '*' saltutil.sync_states
        salt '*' saltutil.sync_utils
        salt '*' saltutil.term_job <job id>
        salt '*' saltutil.update
        salt '*' saltutil.update 0.10.3
        salt '*' saltutil.wheel key.accept match=jerry
        salt '*' schedule.add job1 function='test.ping' seconds=3600
        salt '*' schedule.build_schedule_item job1 function='test.ping' seconds=3600
        salt '*' schedule.delete job1
        salt '*' schedule.disable
        salt '*' schedule.disable_job job1
        salt '*' schedule.enable
        salt '*' schedule.enable_job job1
        salt '*' schedule.list
        salt '*' schedule.list show_all=True
        salt '*' schedule.modify job1 function='test.ping' seconds=3600
        salt '*' schedule.purge
        salt '*' schedule.reload
        salt '*' schedule.run_job job1
        salt '*' schedule.run_job job1 force=True
        salt '*' schedule.save
        salt 'minion' seed.apply path id [config=config_data] \
        salt 'minion' seed.mkconfig [config=config_data] [tmp=tmp_dir] \
        salt '*' serverdensity_device.create lama
        salt '*' serverdensity_device.create rich_lama group=lama_band installedRAM=32768
        salt '*' serverdensity_device.delete 51f7eafcdba4bb235e000ae4
        salt '*' serverdensity_device.get_sd_auth <val>
        salt '*' serverdensity_device.install_agent c2bbdd6689ff46282bdaa07555641498
        salt '*' serverdensity_device.ls
        salt '*' serverdensity_device.ls name=lama
        salt '*' serverdensity_device.ls name=lama group=lama_band installedRAM=32768
        salt '*' serverdensity_device.update 51f7eafcdba4bb235e000ae4 name=lama group=lama_band
        salt '*' serverdensity_device.update 51f7eafcdba4bb235e000ae4 name=better_lama group=rock_lamas swapSpace=512
        salt '*' service.available sshd
        salt '*' service.available sshd limit=upstart
        salt '*' service.available sshd limit=sysvinit
        salt '*' service.disable <service name>
        salt '*' service.disabled <service name>
        salt '*' service.enable <service name>
        salt '*' service.enabled <service name>
        salt '*' service.get_all
        salt '*' service.get_all limit=upstart
        salt '*' service.get_all limit=sysvinit
        salt '*' service.get_disabled
        salt '*' service.get_disabled limit=upstart
        salt '*' service.get_disabled limit=sysvinit
        salt '*' service.get_enabled
        salt '*' service.get_enabled limit=upstart
        salt '*' service.get_enabled limit=sysvinit
        salt '*' service.missing sshd
        salt '*' service.missing sshd limit=upstart
        salt '*' service.missing sshd limit=sysvinit
        salt '*' service.reload <service name>
        salt '*' service.restart <service name>
        salt '*' service.start <service name>
        salt '*' service.status <service name>
        salt '*' service.stop <service name>
        salt '*' shadow.default_hash
        salt '*' shadow.del_password username
        salt '*' shadow.gen_password 'I_am_password'
        salt '*' shadow.gen_password 'I_am_password' crypt_salt'I_am_salt' algorithm=sha256
        salt '*' shadow.info root
        salt '*' shadow.set_date username 0
        salt '*' shadow.set_expire username -1
        salt '*' shadow.set_inactdays username 7
        salt '*' shadow.set_maxdays username 90
        salt '*' shadow.set_mindays username 7
        salt '*' shadow.set_password root '$1$UYCIxa628.9qXjpQCjM4a..'
        salt '*' shadow.set_warndays username 7
        salt '*' sqlite3.fetch /root/test.db 'SELECT * FROM test;'
        salt '*' sqlite3.indexes /root/test.db
        salt '*' sqlite3.indices /root/test.db
        salt '*' sqlite3.modify /root/test.db 'CREATE TABLE test(id INT, testdata TEXT);'
        salt '*' sqlite3.sqlite_version
        salt '*' sqlite3.tables /root/test.db
        salt '*' sqlite3.version
        salt '*' ssh.auth_keys root
        salt '*' ssh.check_key <user> <key> <enc> <comment> <options>
        salt '*' root salt://ssh/keyfile
        salt '*' ssh.check_known_host <user> <hostname> key='AAAA...FAaQ=='
        salt '*' ssh.get_known_host <user> <hostname>
        salt '*' ssh.hash_known_hosts
        salt '*' ssh.host_keys
        salt '*' ssh.recv_known_host <hostname> enc=<enc> port=<port>
        salt '*' ssh.rm_auth_key <user> <key>
        salt '*' ssh.rm_known_host <user> <hostname>
        salt '*' ssh.set_auth_key <user> '<key>' enc='dsa'
        salt '*' ssh.set_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
        salt '*' ssh.set_known_host <user> fingerprint='xx:xx:..:xx' enc='ssh-rsa' config='.ssh/known_hosts'
        salt '*' ssh.user_keys
        salt '*' ssh.user_keys user=user1
        salt '*' ssh.user_keys user=user1 pubfile=/home/user1/.ssh/id_rsa.pub prvfile=/home/user1/.ssh/id_rsa
        salt '*' ssh.user_keys user="['user1','user2'] pubfile=id_rsa.pub prvfile=id_rsa
        salt '*' state.clear_cache
        salt '*' state.high '{"vim": {"pkg": ["installed"]}}'
        salt '*' state.highstate
        salt '*' state.highstate whitelist=sls1_to_run,sls2_to_run
        salt '*' state.highstate exclude=sls_to_exclude
        salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
        salt '*' state.highstate pillar="{foo: 'Foo!', bar: 'Bar!'}"
        salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
        salt '*' state.pkg /tmp/state_pkg.tgz
        salt '*' state.running
        salt '*' state.show_highstate
        salt '*' state.show_low_sls foo
        salt '*' state.show_lowstate
        salt '*' state.show_sls core,edit.vim dev
        salt '*' state.show_top
        salt '*' state.single pkg.installed name=vim
        salt '*' state.sls core,edit.vim dev
        salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
        salt '*' state.sls myslsfile pillar="{foo: 'Foo!', bar: 'Bar!'}"
        salt '*' state.sls_id apache http
        salt '*' state.template '<Path to template on the minion>'
        salt '*' state.template_str '<Template String>'
        salt '*' state.top reverse_top.sls
        salt '*' state.top reverse_top.sls exclude=sls_to_exclude
        salt '*' state.top reverse_top.sls exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
        salt '*' status.all_status
        salt '*' status.cpuinfo
        salt '*' status.cpustats
        salt '*' status.custom
        salt '*' status.diskstats
        salt '*' status.diskusage [paths and/or filesystem types]
        salt '*' status.diskusage         # usage for all filesystems
        salt '*' status.diskusage / /tmp  # usage for / and /tmp
        salt '*' status.diskusage ext?    # usage for ext[234] filesystems
        salt '*' status.diskusage / ext?  # usage for / and all ext filesystems
        salt '*' status.loadavg
        salt '*' status.master
        salt '*' status.meminfo
        salt '*' status.netdev
        salt '*' status.netstats
        salt '*' status.nproc
        salt '*' status.pid <sig>
        salt '*' status.procs
        salt '*' status.uptime
        salt '*' status.version
        salt '*' status.vmstats
        salt '*' status.w
        salt '*' supervisord.add <name>
        salt '*' supervisord.custom "mstop '*gunicorn*'"
        salt '*' supervisord.options foo
        salt '*' supervisord.remove <name>
        salt '*' supervisord.reread
        salt '*' supervisord.restart <service>
        salt '*' supervisord.restart <group>:
        salt '*' supervisord.start <service>
        salt '*' supervisord.start <group>:
        salt '*' supervisord.status
        salt '*' supervisord.status_raw
        salt '*' supervisord.stop <service>
        salt '*' supervisord.stop <group>:
        salt '*' supervisord.update
        salt '*' sys.argspec pkg.install
        salt '*' sys.argspec sys
        salt '*' sys.argspec
        salt '*' sys.doc
        salt '*' sys.doc sys
        salt '*' sys.doc sys.doc
        salt '*' sys.doc network.traceroute user.info
        salt '*' sys.list_functions
        salt '*' sys.list_functions sys
        salt '*' sys.list_functions sys user
        salt '*' sys.list_modules
        salt '*' sys.list_returner_functions
        salt '*' sys.list_returner_functions mysql
        salt '*' sys.list_returner_functions mysql etcd
        salt '*' sys.list_returners
        salt '*' sys.list_runner_functions
        salt '*' sys.list_runner_functions state
        salt '*' sys.list_runner_functions state virt
        salt '*' sys.list_runners
        salt '*' sys.list_state_functions
        salt '*' sys.list_state_functions file
        salt '*' sys.list_state_functions pkg user
        salt '*' sys.list_state_modules
        salt '*' sys.reload_modules
        salt '*' sys.returner_doc
        salt '*' sys.returner_doc sqlite3
        salt '*' sys.returner_doc sqlite3.get_fun
        salt '*' sys.returner_doc sqlite3.get_fun etcd.get_fun
        salt '*' sys.runner_doc
        salt '*' sys.runner_doc cache
        salt '*' sys.runner_doc cache.grains
        salt '*' sys.runner_doc cache.grains mine.get
        salt '*' sys.state_doc
        salt '*' sys.state_doc service
        salt '*' sys.state_doc service.running
        salt '*' sys.state_doc service.running ipables.append
        salt '*' sysctl.assign net.ipv4.ip_forward 1
        salt '*' sysctl.get net.ipv4.ip_forward
        salt '*' sysctl.persist net.ipv4.ip_forward 1
        salt '*' sysctl.show
        salt '*' system.halt
        salt '*' system.init 3
        salt '*' system.poweroff
        salt '*' system.reboot
        salt '*' system.shutdown
        salt '*' test.arg 1 "two" 3.1 txt="hello" wow='{a: 1, b: "hello"}'
        salt '*' test.arg_repr 1 "two" 3.1 txt="hello" wow='{a: 1, b: "hello"}'
           salt '*' test.arg_type 1 'int'
        salt '*' test.collatz 3
        salt '*' test.conf_test
        salt '*' test.cross_test file.gid_to_group 0
        salt '*' test.echo 'foo bar baz quo qux'
        salt '*' test.exception 'Oh noes!'
        salt '*' test.fib 3
        salt '*' test.get_opts
        salt '*' test.kwarg num=1 txt="two" env='{a: 1, b: "hello"}'
        salt '*' test.not_loaded
        salt '*' test.opts_pkg
        salt '*' test.outputter foobar
        salt '*' test.ping
        salt '*' test.provider service
        salt '*' test.providers
        salt '*' test.rand_sleep 60
        salt '*' test.rand_str
        salt '*' test.retcode 42
        salt '*' test.sleep 20
        salt '*' test.stack
        salt '*' test.tty tty0 'This is a test'
        salt '*' test.tty pts3 'This is a test'
        salt '*' test.version
        salt '*' test.versions_information
        salt '*' test.versions_report
        salt '*' timezone.get_hwclock
        salt '*' timezone.get_offset
        salt '*' timezone.get_zone
        salt '*' timezone.get_zonecode
        salt '*' timezone.set_hwclock UTC
        salt '*' timezone.set_zone 'America/Denver'
        salt '*' timezone.zone_compare 'America/Denver'
        salt '*' user.add name <uid> <gid> <groups> <home> <shell>
        salt '*' user.chfullname foo "Foo Bar"
        salt '*' user.chgid foo 4376
        salt '*' user.chgroups foo wheel,root True
        salt '*' user.chhome foo /home/users/foo True
        salt '*' user.chhomephone foo "7735551234"
        salt '*' user.chroomnumber foo 123
        salt '*' user.chshell foo /bin/zsh
        salt '*' user.chuid foo 4376
        salt '*' user.chworkphone foo "7735550123"
        salt '*' user.delete name remove=True force=True
        salt '*' user.getent
        salt '*' user.info root
        salt '*' user.list_groups foo
        salt '*' user.list_users
        salt '*' virtualenv.create /path/to/new/virtualenv
        salt '*' virtualenv.get_site_packages /path/to/my/venv
        salt '*' webutil.useradd /etc/httpd/htpasswd larry badpassword
        salt '*' webutil.useradd /etc/httpd/htpasswd larry badpass opts=ns
        salt '*' webutil.useradd /etc/httpd/htpasswd larry badpassword
        salt '*' webutil.useradd /etc/httpd/htpasswd larry badpass opts=ns
        salt '*' webutil.userdel /etc/httpd/htpasswd larry

你可能感兴趣的:(Saltstack 自动化管理基础篇(一))