Modules
1:查看所有module列表:
salt ‘jcfx-4‘ sys.list_modules
jcfx-4:
- acl
- aliases
- alternatives
- apache
- archive
- artifactory
- at
- beacons
- bigip
- blockdev
- bridge
- btrfs
2:查看指定module的所有function
salt ‘jcfx-4‘ sys.list_functions cp
jcfx-4:
- cp.cache_dir
- cp.cache_file
- cp.cache_files
- cp.cache_local_file
- cp.cache_master
- cp.get_dir
- cp.get_file
- cp.get_file_str
- cp.get_template
- cp.get_url
- cp.hash_file
- cp.is_cached
- cp.list_master
- cp.list_master_dirs
- cp.list_master_symlinks
- cp.list_minion
- cp.list_states
- cp.push
- cp.push_dir
- cp.recv
3:查看指定module用法:
salt ‘jcfx-4‘ sys.doc cp.get_file
cp.get_file:
Used to get a single file from the salt master
CLI Example:
salt ‘*‘ cp.get_file salt://path/to/file /minion/dest
Template rendering can be enabled on both the source and destination file
names like so:
salt ‘*‘ cp.get_file "salt://{{grains.os}}/vimrc" /etc/vimrc template=jinja
This example would instruct all Salt minions to download the vimrc from a
directory with the same name as their os grain and copy it to /etc/vimrc
For larger files, the cp.get_file module also supports gzip compression.
Because gzip is CPU-intensive, this should only be used in scenarios where
the compression ratio is very high (e.g. pretty-printed JSON or YAML
files).
Use the *gzip* named argument to enable it. Valid values are 1..9, where 1
is the lightest compression and 9 the heaviest. 1 uses the least CPU on
the master (and minion), 9 uses the most.
States
1:查看所有states列表:
salt ‘jcfx-4‘ sys.list_state_modules
jcfx-4:
- acl
- alias
- alternatives
- apache
- archive
- artifactory
- at
- beacon
- blockdev
- buildout
- cloud
- cmd
- composer
- cron
2:查看指定states的所有function
salt ‘jcfx-4‘ sys.list_state_functions file
jcfx-4:
- file.absent
- file.accumulated
- file.append
- file.blockreplace
- file.comment
- file.copy
- file.directory
- file.exists
- file.line
- file.managed
- file.missing
- file.mknod
- file.mod_run_check_cmd
- file.patch
- file.prepend
- file.recurse
- file.rename
- file.replace
- file.serialize
- file.symlink
- file.touch
- file.uncomment
3:查看指定states用法:
salt ‘jcfx-4‘ sys.state_doc file
输出略;
4:查看states指定function用法:
salt ‘jcfx-4‘ sys.state_doc file.managed
输出略;