1、查看版本号:
salt --version
[root@master ~]# salt --version salt 2019.2.0 (Fluorine) [root@master ~]#
2、显示依赖关系及版本号:
salt --versions-report
[root@master ~]# salt --versions-report Salt Version: Salt: 2019.2.0 Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.7.2 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.5 (default, Oct 30 2018, 23:45:53) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4 System Versions: dist: centos 7.6.1810 Core locale: UTF-8 machine: x86_64 release: 3.10.0-957.el7.x86_64 system: Linux version: CentOS Linux 7.6.1810 Core [root@master ~]#
3、salt-run 该命令执行runner(salt带的或者自定义的,runner以后会讲),通常在master端执行,比如经常用到的manage
salt-run [options] [runner.func]
a、查看所有minion状态
[root@master ~]# salt-run manage.status #查看所有minion状态
down:
- node01
up:
- master
[root@master ~]#
b、查看所有没在线minion (removekeys=True)
[root@master ~]# salt-run manage.down #查看所有没在线minion - node01 [root@master ~]#
c、查看所有在线minion
[root@master ~]# salt-run manage.up #查看所有在线minion - master [root@master ~]#
4、salt-key 密钥管理,通常在master端执行 salt-key [options] [ -y]
查看所有minion-key
[root@master ~]# salt-key -L
[root@master ~]# salt-key -L
Accepted Keys: #已经接受key的minion
master
Denied Keys:
Unaccepted Keys: #未接受key的minion
node01
Rejected Keys:
[root@master ~]#
接受某个minion-key
salt-key -a <key-name>
[root@master ~]# salt-key -a node01 The following keys are going to be accepted: Unaccepted Keys: node01 Proceed? [n/Y] y Key for minion node01 accepted. [root@master ~]#
master自动接受minion节点,(修改配置master节点上配置文件/etc/salt/master 中 auto_accept: True)
auto_accept: True
[root@master ~]# salt-key -d node01 The following keys are going to be deleted: Accepted Keys: node01 Proceed? [N/y] y Key for minion node01 deleted. [root@master ~]#
接受所有的minion-key
salt-key -A
删除所有的minion-key
salt-key -D
5、salt-call 该命令通常在minion上执行,minion自己执行可执行模块,不是通过master下发job
salt-call [options] <function> [arguments] salt-call test.ping ##自己执行test.ping命令 salt-call cmd.run 'ifconfig' ##自己执行cmd.run函数
6、salt-cp 分发文件到minion上,不支持目录分发,通常在master运行
salt-cp [options] '<target>' SOURCE DEST salt-cp '*' testfile.html /tmp salt-cp 'test*' index.html /tmp/a.html
7、salt-master master运行命令
salt-master [options] salt-master ##前台运行master salt-master -d ##后台运行master salt-master -l debug ##前台debug输出
8、salt-minion minion运行命令
salt-minion [options] salt-minion ##前台运行 salt-minion -d ##后台运行 salt-minion -l debug ##前台debug输出
9、master端查看saltstack内置模块信息
a、简单查找,不包含详细信息 salt ‘node01’ sys.list_modules
[root@master ~]# salt 'node01' sys.list_modules node01: - acl - aliases - alternatives - ansible - apache - archive - artifactory - beacons - bigip - btrfs - buildout - cloud - cmd - composer - config - consul - container_resource - cp - cron - cryptdev - data - defaults - devmap - disk - django - dnsmasq - dnsutil - drbd - environ - etcd - ethtool - event - extfs - file - firewalld - gem - genesis - glassfish - gnome - google_chat - grafana4 - grains - group - hashutil - hello - highstate_doc - hipchat - hosts - http - incron - ini - inspector - introspect - iosconfig - ip - ipset - iptables - jboss7 - jboss7_cli - k8s - kernelpkg - key - keyboard - kmod - locale - locate - log - logrotate - lowpkg - lvm - mandrill - match - mattermost - mine - minion - modjk - mount - msteams - nagios_rpc - namecheap_domains - namecheap_domains_dns - namecheap_domains_ns - namecheap_ssl - namecheap_users - network - nexus - nova - nspawn - nxos_api - openscap - openstack_config - opsgenie - out - pagerduty - pagerduty_util - pam - parallels - partition - peeringdb - pillar - pkg - pkg_resource - postfix - ps - publish - pushover - pyenv - random - random_org - rbenv - rest_sample_utils - restartcheck - ret - rvm - s3 - s6 - salt_proxy - saltcheck - saltutil - schedule - scsi - sdb - seed - serverdensity_device - service - shadow - slack - slsutil - smbios - smtp - solrcloud - sqlite3 - ssh - state - status - statuspage - supervisord - sys - sysctl - sysfs - syslog_ng - system - telegram - telemetry - temp - test - timezone - tuned - udev - uptime - user - vault - vbox_guest - virtualenv - vsphere - webutil - xfs - zabbix - zenoss [root@master ~]#
b、较详细的查看salt模块信息,即模块中有哪些方法 salt 'node01' sys.list_functions
[root@master ~]# salt 'node01' sys.list_functions node01: - acl.delfacl - acl.getfacl - acl.modfacl - acl.version - acl.wipefacls - aliases.get_target - aliases.has_target - aliases.list_aliases - aliases.rm_alias - aliases.set_target - alternatives.auto - alternatives.check_exists - alternatives.check_installed - alternatives.display - alternatives.install - alternatives.remove - alternatives.set - alternatives.show_current - alternatives.show_link - ansible.help - ansible.list - ansible.playbooks - apache.config - apache.directives - apache.fullversion - apache.modules - apache.server_status - apache.servermods - apache.signal - apache.useradd - apache.userdel - apache.version - apache.vhosts - archive.cmd_unzip - archive.cmd_zip - archive.gunzip - archive.gzip - archive.is_encrypted - archive.list - archive.rar - archive.tar - archive.unrar - archive.unzip - archive.zip - artifactory.get_latest_release - artifactory.get_latest_snapshot - artifactory.get_release - artifactory.get_snapshot - beacons.add - beacons.delete - beacons.disable - beacons.disable_beacon - beacons.enable - beacons.enable_beacon - beacons.list - beacons.list_available - beacons.modify - beacons.reset - beacons.save - bigip.add_pool_member - bigip.commit_transaction - bigip.create_monitor - bigip.create_node - bigip.create_pool - bigip.create_profile - bigip.create_virtual - bigip.delete_monitor - bigip.delete_node - bigip.delete_pool - bigip.delete_pool_member - bigip.delete_profile - bigip.delete_transaction - bigip.delete_virtual - bigip.list_monitor - bigip.list_node - bigip.list_pool - bigip.list_profile - bigip.list_transaction - bigip.list_virtual - bigip.modify_monitor - bigip.modify_node - bigip.modify_pool - bigip.modify_pool_member - bigip.modify_profile - bigip.modify_virtual - bigip.replace_pool_members - bigip.start_transaction - btrfs.add - btrfs.convert - btrfs.defragment - btrfs.delete - btrfs.devices - btrfs.features - btrfs.info - btrfs.mkfs - btrfs.properties - btrfs.resize - btrfs.usage - btrfs.version - buildout.bootstrap - buildout.buildout - buildout.run_buildout - buildout.upgrade_bootstrap - cloud.action - cloud.create - cloud.destroy - cloud.full_query - cloud.get_instance - cloud.has_instance - cloud.list_images - cloud.list_locations - cloud.list_sizes - cloud.map_run - cloud.network_create - cloud.network_list - cloud.profile - cloud.query - cloud.select_query - cloud.virtual_interface_create - cloud.virtual_interface_list - cloud.volume_attach - cloud.volume_create - cloud.volume_delete - cloud.volume_detach - cloud.volume_list - cmd.exec_code - cmd.exec_code_all - cmd.has_exec - cmd.powershell - cmd.powershell_all - cmd.retcode - cmd.run - cmd.run_all - cmd.run_bg - cmd.run_chroot - cmd.run_stderr - cmd.run_stdout - cmd.script - cmd.script_retcode - cmd.shell - cmd.shell_info - cmd.shells - cmd.tty - cmd.which - cmd.which_bin - composer.did_composer_install - composer.install - composer.selfupdate - composer.update - config.backup_mode - config.dot_vals - config.gather_bootstrap_script - config.get - config.items - config.manage_mode - config.merge - config.option - config.valid_fileproto - consul.acl_clone - consul.acl_create - consul.acl_delete - consul.acl_info - consul.acl_list - consul.acl_update - consul.agent_check_deregister - consul.agent_check_fail - consul.agent_check_pass - consul.agent_check_register - consul.agent_check_warn - consul.agent_checks - consul.agent_join - consul.agent_leave - consul.agent_maintenance - consul.agent_members - consul.agent_self - consul.agent_service_deregister - consul.agent_service_maintenance - consul.agent_service_register - consul.agent_services - consul.catalog_datacenters - consul.catalog_deregister - consul.catalog_node - consul.catalog_nodes - consul.catalog_register - consul.catalog_service - consul.catalog_services - consul.delete - consul.event_fire - consul.event_list - consul.get - consul.health_checks - consul.health_node - consul.health_service - consul.health_state - consul.list - consul.put - consul.session_create - consul.session_destroy - consul.session_info - consul.session_list - consul.status_leader - consul.status_peers - container_resource.cache_file - container_resource.copy_to - container_resource.run - cp.cache_dir - cp.cache_file - cp.cache_files - cp.cache_local_file - cp.cache_master - cp.envs - 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 - cp.recv_chunked - cp.stat_file - cron.list_tab - cron.ls - cron.raw_cron - cron.rm - cron.rm_env - cron.rm_job - cron.rm_special - cron.set_env - cron.set_job - cron.set_special - cron.write_cron_file - cron.write_cron_file_verbose - cryptdev.active - cryptdev.close - cryptdev.crypttab - cryptdev.open - cryptdev.rm_crypttab - cryptdev.set_crypttab - data.cas - data.clear - data.dump - data.get - data.has_key - data.items - data.keys - data.load - data.pop - data.update - data.values - defaults.deepcopy - defaults.get - defaults.merge - defaults.update - devmap.multipath_flush - devmap.multipath_list - disk.blkid - disk.dump - disk.format - disk.fstype - disk.inodeusage - disk.percent - disk.resize2fs - disk.smart_attributes - disk.tune - disk.usage - disk.wipe - django.collectstatic - django.command - django.createsuperuser - django.loaddata - django.syncdb - dnsmasq.fullversion - dnsmasq.get_config - dnsmasq.set_config - dnsmasq.version - dnsutil.A - dnsutil.AAAA - dnsutil.MX - dnsutil.NS - dnsutil.SPF - dnsutil.check_ip - dnsutil.hosts_append - dnsutil.hosts_remove - dnsutil.parse_hosts - dnsutil.parse_zone - dnsutil.serial - drbd.overview - environ.get - environ.has_value - environ.item - environ.items - environ.setenv - environ.setval - etcd.get - etcd.ls - etcd.rm - etcd.set - etcd.tree - etcd.update - etcd.watch - ethtool.set_coalesce - ethtool.set_offload - ethtool.set_ring - ethtool.show_coalesce - ethtool.show_driver - ethtool.show_offload - ethtool.show_ring - event.fire - event.fire_master - event.send - extfs.attributes - extfs.blocks - extfs.dump - extfs.mkfs - extfs.tune - file.access - file.append - file.apply_template_on_contents - file.basename - file.blockreplace - file.chattr - file.check_file_meta - file.check_hash - file.check_managed - file.check_managed_changes - file.check_perms - file.chgrp - file.chown - file.comment - file.comment_line - file.contains - file.contains_glob - file.contains_regex - file.copy - file.delete_backup - file.directory_exists - file.dirname - file.diskusage - file.extract_hash - file.file_exists - file.find - file.get_devmm - file.get_diff - file.get_gid - file.get_group - file.get_hash - file.get_managed - file.get_mode - file.get_selinux_context - file.get_source_sum - file.get_sum - file.get_uid - file.get_user - file.gid_to_group - file.grep - file.group_to_gid - file.is_blkdev - file.is_chrdev - file.is_fifo - file.is_link - file.join - file.lchown - file.line - file.link - file.list_backup - file.list_backups - file.list_backups_dir - file.lsattr - file.lstat - file.makedirs - file.makedirs_perms - file.manage_file - file.mkdir - file.mknod - file.mknod_blkdev - file.mknod_chrdev - file.mknod_fifo - file.move - file.normpath - file.open_files - file.pardir - file.patch - file.path_exists_glob - file.prepend - file.psed - file.read - file.readdir - file.readlink - file.remove - file.remove_backup - file.rename - file.replace - file.restore_backup - file.restorecon - file.rmdir - file.search - file.sed - file.sed_contains - file.seek_read - file.seek_write - file.set_mode - file.set_selinux_context - file.source_list - file.stats - file.statvfs - file.symlink - file.touch - file.truncate - file.uid_to_user - file.uncomment - file.user_to_uid - file.write - firewalld.add_interface - firewalld.add_masquerade - firewalld.add_port - firewalld.add_port_fwd - firewalld.add_rich_rule - firewalld.add_service - firewalld.add_service_port - firewalld.add_service_protocol - firewalld.add_source - firewalld.allow_icmp - firewalld.block_icmp - firewalld.default_zone - firewalld.delete_service - firewalld.delete_zone - firewalld.get_icmp_types - firewalld.get_interfaces - firewalld.get_masquerade - firewalld.get_rich_rules - firewalld.get_service_ports - firewalld.get_service_protocols - firewalld.get_services - firewalld.get_sources - firewalld.get_zones - firewalld.list_all - firewalld.list_icmp_block - firewalld.list_port_fwd - firewalld.list_ports - firewalld.list_services - firewalld.list_zones - firewalld.make_permanent - firewalld.new_service - firewalld.new_zone - firewalld.reload_rules - firewalld.remove_interface - firewalld.remove_masquerade - firewalld.remove_port - firewalld.remove_port_fwd - firewalld.remove_rich_rule - firewalld.remove_service - firewalld.remove_service_port - firewalld.remove_service_protocol - firewalld.remove_source - firewalld.set_default_zone - firewalld.version - gem.install - gem.list - gem.list_upgrades - gem.sources_add - gem.sources_list - gem.sources_remove - gem.uninstall - gem.update - gem.update_system - genesis.avail_platforms - genesis.bootstrap - genesis.ldd_deps - genesis.mksls - genesis.pack - genesis.unpack - glassfish.create_admin_object_resource - glassfish.create_connector_c_pool - glassfish.create_connector_resource - glassfish.create_jdbc_connection_pool - glassfish.create_jdbc_resource - glassfish.delete_admin_object_resource - glassfish.delete_connector_c_pool - glassfish.delete_connector_resource - glassfish.delete_jdbc_connection_pool - glassfish.delete_jdbc_resource - glassfish.delete_system_properties - glassfish.enum_admin_object_resource - glassfish.enum_connector_c_pool - glassfish.enum_connector_resource - glassfish.enum_jdbc_connection_pool - glassfish.enum_jdbc_resource - glassfish.get_admin_object_resource - glassfish.get_connector_c_pool - glassfish.get_connector_resource - glassfish.get_jdbc_connection_pool - glassfish.get_jdbc_resource - glassfish.get_system_properties - glassfish.quote - glassfish.unquote - glassfish.update_admin_object_resource - glassfish.update_connector_c_pool - glassfish.update_connector_resource - glassfish.update_jdbc_connection_pool - glassfish.update_jdbc_resource - glassfish.update_system_properties - gnome.get - gnome.getClockFormat - gnome.getClockShowDate - gnome.getIdleActivation - gnome.getIdleDelay - gnome.ping - gnome.set - gnome.setClockFormat - gnome.setClockShowDate - gnome.setIdleActivation - gnome.setIdleDelay - google_chat.send_message - grafana4.create_datasource - grafana4.create_org - grafana4.create_org_user - grafana4.create_update_dashboard - grafana4.create_user - grafana4.delete_dashboard - grafana4.delete_datasource - grafana4.delete_org - grafana4.delete_org_user - grafana4.delete_user - grafana4.delete_user_org - grafana4.get_dashboard - grafana4.get_datasource - grafana4.get_datasources - grafana4.get_org - grafana4.get_org_address - grafana4.get_org_prefs - grafana4.get_org_users - grafana4.get_orgs - grafana4.get_user - grafana4.get_user_data - grafana4.get_user_orgs - grafana4.get_users - grafana4.switch_org - grafana4.update_datasource - grafana4.update_org - grafana4.update_org_address - grafana4.update_org_prefs - grafana4.update_org_user - grafana4.update_user - grafana4.update_user_password - grafana4.update_user_permissions - grains.append - grains.delkey - grains.delval - grains.equals - grains.fetch - grains.filter_by - grains.get - grains.get_or_set_hash - grains.has_value - grains.item - grains.items - grains.ls - grains.remove - grains.set - grains.setval - grains.setvals - group.add - group.adduser - group.chgid - group.delete - group.deluser - group.getent - group.info - group.members - hashutil.base64_b64decode - hashutil.base64_b64encode - hashutil.base64_decodefile - hashutil.base64_decodestring - hashutil.base64_encodefile - hashutil.base64_encodestring - hashutil.digest - hashutil.digest_file - hashutil.github_signature - hashutil.hmac_signature - hashutil.md5_digest - hashutil.sha256_digest - hashutil.sha512_digest - hello.world - highstate_doc.markdown_basic_jinja_template - highstate_doc.markdown_default_jinja_template - highstate_doc.markdown_full_jinja_template - highstate_doc.proccess_lowstates - highstate_doc.proccesser_markdown - highstate_doc.read_file - highstate_doc.render - hipchat.find_room - hipchat.find_user - hipchat.list_rooms - hipchat.list_users - hipchat.send_message - hosts.add_host - hosts.get_alias - hosts.get_ip - hosts.has_pair - hosts.list_hosts - hosts.rm_host - hosts.set_host - http.query - http.update_ca_bundle - http.wait_for_successful_query - incron.list_tab - incron.ls - incron.raw_incron - incron.raw_system_incron - incron.rm - incron.rm_job - incron.set_job - incron.write_incron_file - incron.write_incron_file_verbose - ini.get_ini - ini.get_option - ini.get_section - ini.remove_option - ini.remove_section - ini.set_option - inspector.build - inspector.delete - inspector.export - inspector.inspect - inspector.query - inspector.snapshots - introspect.enabled_service_owners - introspect.running_service_owners - introspect.service_highstate - iosconfig.clean - iosconfig.diff_text - iosconfig.diff_tree - iosconfig.merge_diff - iosconfig.merge_text - iosconfig.merge_tree - iosconfig.tree - ip.apply_network_settings - ip.build_bond - ip.build_interface - ip.build_network_settings - ip.build_routes - ip.down - ip.get_bond - ip.get_interface - ip.get_network_settings - ip.get_routes - ip.up - ipset.add - ipset.check - ipset.check_set - ipset.delete - ipset.delete_set - ipset.flush - ipset.list_sets - ipset.long_range - ipset.new_set - ipset.rename_set - ipset.test - ipset.version - iptables.append - iptables.build_rule - iptables.check - iptables.check_chain - iptables.delete - iptables.delete_chain - iptables.flush - iptables.get_policy - iptables.get_rules - iptables.get_saved_policy - iptables.get_saved_rules - iptables.insert - iptables.new_chain - iptables.save - iptables.set_policy - iptables.version - jboss7.create_datasource - jboss7.create_simple_binding - jboss7.deploy - jboss7.list_deployments - jboss7.read_datasource - jboss7.read_simple_binding - jboss7.reload - jboss7.remove_datasource - jboss7.status - jboss7.stop_server - jboss7.undeploy - jboss7.update_datasource - jboss7.update_simple_binding - jboss7_cli.run_command - jboss7_cli.run_operation - k8s.create_namespace - k8s.create_secret - k8s.delete_secret - k8s.get_labels - k8s.get_namespaces - k8s.get_secrets - k8s.label_absent - k8s.label_folder_absent - k8s.label_present - k8s.update_secret - kernelpkg.active - kernelpkg.cleanup - kernelpkg.latest_available - kernelpkg.latest_installed - kernelpkg.list_installed - kernelpkg.needs_reboot - kernelpkg.remove - kernelpkg.upgrade - kernelpkg.upgrade_available - key.finger - key.finger_master - keyboard.get_sys - keyboard.get_x - keyboard.set_sys - keyboard.set_x - kmod.available - kmod.check_available - kmod.is_loaded - kmod.load - kmod.lsmod - kmod.mod_list - kmod.remove - locale.avail - locale.gen_locale - locale.get_locale - locale.list_avail - locale.set_locale - locate.locate - locate.stats - locate.updatedb - locate.version - log.critical - log.debug - log.error - log.exception - log.info - log.warning - logrotate.get - logrotate.set - logrotate.show_conf - lowpkg.bin_pkg_info - lowpkg.checksum - lowpkg.diff - lowpkg.file_dict - lowpkg.file_list - lowpkg.info - lowpkg.list_pkgs - lowpkg.modified - lowpkg.owner - lowpkg.verify - lowpkg.version_cmp - lvm.fullversion - lvm.lvcreate - lvm.lvdisplay - lvm.lvremove - lvm.lvresize - lvm.pvcreate - lvm.pvdisplay - lvm.pvremove - lvm.version - lvm.vgcreate - lvm.vgdisplay - lvm.vgextend - lvm.vgremove - mandrill.send - match.compound - match.data - match.filter_by - match.glob - match.grain - match.grain_pcre - match.ipcidr - match.list - match.pcre - match.pillar - match.pillar_pcre - match.search_by - mattermost.post_message - mine.delete - mine.flush - mine.get - mine.get_docker - mine.send - mine.update - mine.valid - minion.kill - minion.list - minion.restart - modjk.bulk_activate - modjk.bulk_disable - modjk.bulk_recover - modjk.bulk_stop - modjk.dump_config - modjk.get_running - modjk.lb_edit - modjk.list_configured_members - modjk.recover_all - modjk.reset_stats - modjk.version - modjk.worker_activate - modjk.worker_disable - modjk.worker_edit - modjk.worker_recover - modjk.worker_status - modjk.worker_stop - modjk.workers - mount.active - mount.automaster - mount.delete_mount_cache - mount.filesystems - mount.fstab - mount.is_fuse_exec - mount.is_mounted - mount.mount - mount.read_mount_cache - mount.remount - mount.rm_automaster - mount.rm_filesystems - mount.rm_fstab - mount.rm_vfstab - mount.set_automaster - mount.set_filesystems - mount.set_fstab - mount.set_vfstab - mount.swapoff - mount.swapon - mount.swaps - mount.umount - mount.vfstab - mount.write_mount_cache - msteams.post_card - nagios_rpc.host_status - nagios_rpc.service_status - namecheap_domains.check - namecheap_domains.create - namecheap_domains.get_info - namecheap_domains.get_list - namecheap_domains.get_tld_list - namecheap_domains.reactivate - namecheap_domains.renew - namecheap_domains_dns.get_hosts - namecheap_domains_dns.get_list - namecheap_domains_dns.set_custom - namecheap_domains_dns.set_default - namecheap_domains_dns.set_hosts - namecheap_domains_ns.create - namecheap_domains_ns.delete - namecheap_domains_ns.get_info - namecheap_domains_ns.update - namecheap_ssl.activate - namecheap_ssl.create - namecheap_ssl.get_info - namecheap_ssl.get_list - namecheap_ssl.parse_csr - namecheap_ssl.reissue - namecheap_ssl.renew - namecheap_users.check_balances - namecheap_users.get_balances - network.active_tcp - network.arp - network.calc_net - network.connect - network.convert_cidr - network.default_route - network.dig - network.get_bufsize - network.get_fqdn - network.get_hostname - network.get_route - network.hw_addr - network.hwaddr - network.ifacestartswith - network.in_subnet - network.interface - network.interface_ip - network.interfaces - network.ip_addrs - network.ip_addrs6 - network.ip_in_subnet - network.ipaddrs - network.ipaddrs6 - network.iphexval - network.is_loopback - network.is_private - network.mod_bufsize - network.mod_hostname - network.netstat - network.ping - network.reverse_ip - network.routes - network.subnets - network.subnets6 - network.traceroute - network.wol - nexus.get_latest_release - nexus.get_latest_snapshot - nexus.get_release - nexus.get_snapshot - nexus.get_snapshot_version_string - nova.boot - nova.delete - nova.flavor_create - nova.flavor_delete - nova.flavor_list - nova.image_list - nova.image_meta_delete - nova.image_meta_set - nova.keypair_add - nova.keypair_delete - nova.keypair_list - nova.list - nova.lock - nova.resume - nova.secgroup_create - nova.secgroup_delete - nova.secgroup_list - nova.server_by_name - nova.server_list - nova.server_list_detailed - nova.server_show - nova.show - nova.suspend - nova.volume_attach - nova.volume_create - nova.volume_delete - nova.volume_detach - nova.volume_list - nova.volume_show - nspawn.bootstrap_container - nspawn.bootstrap_salt - nspawn.copy_to - nspawn.cp - nspawn.destroy - nspawn.disable - nspawn.enable - nspawn.exists - nspawn.info - nspawn.list - nspawn.list_all - nspawn.list_running - nspawn.list_stopped - nspawn.pid - nspawn.poweroff - nspawn.pull_dkr - nspawn.pull_docker - nspawn.pull_raw - nspawn.pull_tar - nspawn.reboot - nspawn.remove - nspawn.restart - nspawn.retcode - nspawn.run - nspawn.run_all - nspawn.run_stderr - nspawn.run_stdout - nspawn.start - nspawn.state - nspawn.stop - nspawn.terminate - nxos_api.config - nxos_api.rpc - nxos_api.show - openscap.xccdf - openstack_config.delete - openstack_config.get - openstack_config.set - opsgenie.post_data - out.html_format - out.out_format - out.string_format - pagerduty.create_event - pagerduty.list_escalation_policies - pagerduty.list_incidents - pagerduty.list_maintenance_windows - pagerduty.list_policies - pagerduty.list_schedules - pagerduty.list_services - pagerduty.list_users - pagerduty.list_windows - pagerduty_util.create_or_update_resource - pagerduty_util.delete_resource - pagerduty_util.get_escalation_policies - pagerduty_util.get_resource - pagerduty_util.get_schedules - pagerduty_util.get_services - pagerduty_util.get_users - pagerduty_util.resource_absent - pagerduty_util.resource_present - pam.read_file - parallels.clone - parallels.delete - parallels.delete_snapshot - parallels.exec - parallels.exists - parallels.list_snapshots - parallels.list_vms - parallels.prlctl - parallels.prlsrvctl - parallels.reset - parallels.restart - parallels.revert_snapshot - parallels.snapshot - parallels.snapshot_id_to_name - parallels.snapshot_name_to_id - parallels.start - parallels.status - parallels.stop - partition.align_check - partition.check - partition.cp - partition.exists - partition.get_block_device - partition.get_id - partition.list - partition.mkfs - partition.mklabel - partition.mkpart - partition.mkpartfs - partition.name - partition.probe - partition.rescue - partition.resize - partition.rm - partition.set - partition.set_id - partition.system_types - partition.toggle - peeringdb.clean_kwargs - peeringdb.get_fac - peeringdb.get_ix - peeringdb.get_ixfac - peeringdb.get_ixlan - peeringdb.get_ixpfx - peeringdb.get_net - peeringdb.get_netfac - peeringdb.get_netixlan - peeringdb.get_org - peeringdb.get_poc - pillar.data - pillar.ext - pillar.fetch - pillar.file_exists - pillar.filter_by - pillar.get - pillar.item - pillar.items - pillar.keys - pillar.ls - pillar.obfuscate - pillar.raw - pkg.available_version - pkg.clean_metadata - pkg.del_repo - pkg.diff - pkg.download - pkg.file_dict - pkg.file_list - pkg.get_locked_packages - pkg.get_repo - pkg.group_diff - pkg.group_info - pkg.group_install - pkg.group_list - pkg.groupinstall - pkg.hold - pkg.info_installed - pkg.install - pkg.latest_version - pkg.list_downloaded - pkg.list_holds - pkg.list_installed_patches - pkg.list_patches - pkg.list_pkgs - pkg.list_repo_pkgs - pkg.list_repos - pkg.list_updates - pkg.list_upgrades - pkg.mod_repo - pkg.modified - pkg.normalize_name - pkg.owner - pkg.purge - pkg.refresh_db - pkg.remove - pkg.unhold - pkg.update - pkg.upgrade - pkg.upgrade_available - pkg.verify - pkg.version - pkg.version_cmp - pkg_resource.add_pkg - pkg_resource.check_extra_requirements - pkg_resource.format_pkg_list - pkg_resource.format_version - pkg_resource.pack_sources - pkg_resource.parse_targets - pkg_resource.sort_pkglist - pkg_resource.stringify - pkg_resource.version - pkg_resource.version_clean - postfix.delete - postfix.hold - postfix.requeue - postfix.set_main - postfix.set_master - postfix.show_main - postfix.show_master - postfix.show_queue - postfix.unhold - ps.boot_time - ps.cpu_percent - ps.cpu_times - ps.disk_io_counters - ps.disk_partition_usage - ps.disk_partitions - ps.disk_usage - ps.get_pid_list - ps.get_users - ps.kill_pid - ps.lsof - ps.netstat - ps.network_io_counters - ps.num_cpus - ps.pgrep - ps.pkill - ps.proc_info - ps.psaux - ps.ss - ps.swap_memory - ps.top - ps.total_physical_memory - ps.virtual_memory - publish.full_data - publish.publish - publish.runner - pushover.post_message - pyenv.default - pyenv.do - pyenv.do_with_python - pyenv.install - pyenv.install_python - pyenv.is_installed - pyenv.list - pyenv.rehash - pyenv.uninstall_python - pyenv.update - pyenv.versions - random.get_str - random.hash - random.rand_int - random.seed - random.shadow_hash - random.str_encode - random_org.generateBlobs - random_org.generateDecimalFractions - random_org.generateGaussians - random_org.generateIntegers - random_org.generateStrings - random_org.generateUUIDs - random_org.getUsage - rbenv.default - rbenv.do - rbenv.do_with_ruby - rbenv.install - rbenv.install_ruby - rbenv.is_installed - rbenv.list - rbenv.rehash - rbenv.uninstall_ruby - rbenv.update - rbenv.versions - rest_sample_utils.fix_outage - rest_sample_utils.get_test_string - restartcheck.restartcheck - ret.get_fun - ret.get_jid - ret.get_jids - ret.get_minions - rvm.do - rvm.gemset_copy - rvm.gemset_create - rvm.gemset_delete - rvm.gemset_empty - rvm.gemset_list - rvm.gemset_list_all - rvm.get - rvm.install - rvm.install_ruby - rvm.is_installed - rvm.list - rvm.reinstall_ruby - rvm.rubygems - rvm.set_default - rvm.wrapper - s3.delete - s3.get - s3.head - s3.put - s6.available - s6.full_restart - s6.get_all - s6.missing - s6.reload - s6.restart - s6.start - s6.status - s6.stop - s6.term - salt_proxy.configure_proxy - salt_proxy.is_running - saltcheck.dumps - saltcheck.loads - saltcheck.run_highstate_tests - saltcheck.run_state_tests - saltcheck.run_test - saltcheck.update_master_cache - saltutil.clear_cache - saltutil.clear_job_cache - saltutil.cmd - saltutil.cmd_iter - saltutil.find_cached_job - saltutil.find_job - saltutil.is_running - saltutil.kill_all_jobs - saltutil.kill_job - saltutil.list_extmods - saltutil.mmodule - saltutil.pillar_refresh - saltutil.refresh_beacons - saltutil.refresh_grains - saltutil.refresh_matchers - saltutil.refresh_modules - saltutil.refresh_pillar - saltutil.regen_keys - saltutil.revoke_auth - saltutil.runner - saltutil.running - saltutil.signal_job - saltutil.sync_all - saltutil.sync_beacons - saltutil.sync_clouds - saltutil.sync_engines - saltutil.sync_grains - saltutil.sync_log_handlers - saltutil.sync_matchers - saltutil.sync_modules - saltutil.sync_output - saltutil.sync_outputters - saltutil.sync_pillar - saltutil.sync_proxymodules - saltutil.sync_renderers - saltutil.sync_returners - saltutil.sync_sdb - saltutil.sync_serializers - saltutil.sync_states - saltutil.sync_thorium - saltutil.sync_utils - saltutil.term_all_jobs - saltutil.term_job - saltutil.update - saltutil.wheel - schedule.add - schedule.build_schedule_item - schedule.copy - schedule.delete - schedule.disable - schedule.disable_job - schedule.enable - schedule.enable_job - schedule.is_enabled - schedule.list - schedule.modify - schedule.move - schedule.postpone_job - schedule.purge - schedule.reload - schedule.run_job - schedule.save - schedule.show_next_fire_time - schedule.skip_job - scsi.ls - scsi.rescan_all - sdb.delete - sdb.get - sdb.get_or_set_hash - sdb.set - seed.apply - seed.mkconfig - seed.prep_bootstrap - serverdensity_device.create - serverdensity_device.delete - serverdensity_device.get_sd_auth - serverdensity_device.install_agent - serverdensity_device.ls - serverdensity_device.update - service.available - service.disable - service.disabled - service.enable - service.enabled - service.execs - service.force_reload - service.get_all - service.get_disabled - service.get_enabled - service.get_running - service.get_static - service.mask - service.masked - service.missing - service.reload - service.restart - service.show - service.start - service.status - service.stop - service.systemctl_reload - service.unmask - shadow.default_hash - shadow.del_password - shadow.gen_password - shadow.info - shadow.list_users - shadow.lock_password - shadow.set_date - shadow.set_expire - shadow.set_inactdays - shadow.set_maxdays - shadow.set_mindays - shadow.set_password - shadow.set_warndays - shadow.unlock_password - slack.call_hook - slack.find_room - slack.find_user - slack.list_rooms - slack.list_users - slack.post_message - slsutil.deserialize - slsutil.merge - slsutil.merge_all - slsutil.renderer - slsutil.serialize - slsutil.update - smbios.get - smbios.records - smtp.send_msg - solrcloud.alias_exists - solrcloud.alias_get_collections - solrcloud.alias_set_collections - solrcloud.cluster_status - solrcloud.collection_backup - solrcloud.collection_backup_all - solrcloud.collection_check_options - solrcloud.collection_create - solrcloud.collection_creation_options - solrcloud.collection_exists - solrcloud.collection_get_options - solrcloud.collection_list - solrcloud.collection_reload - solrcloud.collection_set_options - sqlite3.fetch - sqlite3.indexes - sqlite3.indices - sqlite3.modify - sqlite3.sqlite_version - sqlite3.tables - sqlite3.version - ssh.auth_keys - ssh.check_key - ssh.check_key_file - ssh.check_known_host - ssh.get_known_host - ssh.get_known_host_entries - ssh.hash_known_hosts - ssh.host_keys - ssh.key_is_encrypted - ssh.recv_known_host - ssh.recv_known_host_entries - ssh.rm_auth_key - ssh.rm_auth_key_from_file - ssh.rm_known_host - ssh.set_auth_key - ssh.set_auth_key_from_file - ssh.set_known_host - ssh.user_keys - state.apply - state.check_request - state.clear_cache - state.clear_request - state.disable - state.enable - state.event - state.get_pauses - state.high - state.highstate - state.id_exists - state.list_disabled - state.low - state.orchestrate - state.pause - state.pkg - state.request - state.resume - state.run_request - state.running - state.show_highstate - state.show_low_sls - state.show_lowstate - state.show_sls - state.show_state_usage - state.show_states - state.show_top - state.single - state.sls - state.sls_exists - state.sls_id - state.soft_kill - state.template - state.template_str - state.top - status.all_status - status.cpuinfo - status.cpustats - status.custom - status.diskstats - status.diskusage - status.loadavg - status.master - status.meminfo - status.netdev - status.netstats - status.nproc - status.pid - status.ping_master - status.procs - status.proxy_reconnect - status.time - status.uptime - status.version - status.vmstats - status.w - statuspage.create - statuspage.delete - statuspage.retrieve - statuspage.update - supervisord.add - supervisord.custom - supervisord.options - supervisord.remove - supervisord.reread - supervisord.restart - supervisord.start - supervisord.status - supervisord.status_raw - supervisord.stop - supervisord.update - sys.argspec - sys.doc - sys.list_functions - sys.list_modules - sys.list_renderers - sys.list_returner_functions - sys.list_returners - sys.list_runner_functions - sys.list_runners - sys.list_state_functions - sys.list_state_modules - sys.reload_modules - sys.renderer_doc - sys.returner_argspec - sys.returner_doc - sys.runner_argspec - sys.runner_doc - sys.state_argspec - sys.state_doc - sys.state_schema - sysctl.assign - sysctl.default_config - sysctl.get - sysctl.persist - sysctl.show - sysfs.attr - sysfs.interfaces - sysfs.read - sysfs.target - sysfs.write - syslog_ng.config - syslog_ng.config_test - syslog_ng.get_config_file - syslog_ng.modules - syslog_ng.reload - syslog_ng.set_binary_path - syslog_ng.set_config_file - syslog_ng.set_parameters - syslog_ng.start - syslog_ng.stats - syslog_ng.stop - syslog_ng.version - syslog_ng.write_config - syslog_ng.write_version - system.get_computer_desc - system.get_computer_name - system.get_reboot_required_witnessed - system.get_system_date - system.get_system_date_time - system.get_system_time - system.halt - system.has_settable_hwclock - system.init - system.poweroff - system.reboot - system.set_computer_desc - system.set_computer_name - system.set_reboot_required_witnessed - system.set_system_date - system.set_system_date_time - system.set_system_time - system.shutdown - telegram.post_message - telemetry.create_alarm - telemetry.delete_alarms - telemetry.get_alarms - telemetry.get_alert_config - telemetry.get_notification_channel_id - telemetry.update_alarm - temp.dir - temp.file - test.arg - test.arg_clean - test.arg_repr - test.arg_type - test.assertion - test.attr_call - test.collatz - test.conf_test - test.cross_test - test.echo - test.exception - test.false - test.fib - test.get_opts - test.kwarg - test.module_report - test.not_loaded - test.opts_pkg - test.outputter - test.ping - test.provider - test.providers - test.raise_exception - test.rand_sleep - test.rand_str - test.random_hash - test.retcode - test.sleep - test.stack - test.true - test.try - test.tty - test.version - test.versions - test.versions_information - test.versions_report - timezone.get_hwclock - timezone.get_offset - timezone.get_zone - timezone.get_zonecode - timezone.set_hwclock - timezone.set_zone - timezone.zone_compare - tuned.active - tuned.list - tuned.off - tuned.profile - udev.env - udev.exportdb - udev.info - udev.links - udev.name - udev.path - uptime.check_exists - uptime.checks_list - uptime.create - uptime.delete - user.add - user.chfullname - user.chgid - user.chgroups - user.chhome - user.chhomephone - user.chloginclass - user.chother - user.chroomnumber - user.chshell - user.chuid - user.chworkphone - user.delete - user.get_loginclass - user.getent - user.info - user.list_groups - user.list_users - user.primary_group - user.rename - vault.delete_secret - vault.list_secrets - vault.read_secret - vault.write_raw - vault.write_secret - vbox_guest.additions_install - vbox_guest.additions_mount - vbox_guest.additions_remove - vbox_guest.additions_umount - vbox_guest.additions_version - vbox_guest.grant_access_to_shared_folders_to - vbox_guest.list_shared_folders_users - virtualenv.create - virtualenv.get_distribution_path - virtualenv.get_resource_content - virtualenv.get_resource_path - virtualenv.get_site_packages - vsphere.add_host_to_dvs - vsphere.compare_vm_configs - vsphere.get_host_datetime - vsphere.get_ntp_config - vsphere.get_proxy_type - vsphere.get_service_policy - vsphere.get_service_running - vsphere.get_ssh_key - vsphere.get_vm_config - vsphere.get_vmotion_enabled - vsphere.get_vsan_eligible_disks - vsphere.get_vsan_enabled - vsphere.gets_service_instance_via_proxy - vsphere.ignores_kwargs - vsphere.list_clusters - vsphere.list_datacenters - vsphere.list_datastore_clusters - vsphere.list_datastores - vsphere.list_diff - vsphere.list_dvs - vsphere.list_folders - vsphere.list_hosts - vsphere.list_networks - vsphere.list_non_ssds - vsphere.list_resourcepools - vsphere.list_ssds - vsphere.list_vapps - vsphere.list_vms - vsphere.recursive_diff - vsphere.service_restart - vsphere.service_start - vsphere.service_stop - vsphere.set_ntp_config - vsphere.set_service_policy - vsphere.supports_proxies - vsphere.system_info - vsphere.update_host_datetime - vsphere.update_host_password - vsphere.upload_ssh_key - vsphere.vmotion_disable - vsphere.vmotion_enable - vsphere.vsan_add_disks - vsphere.vsan_disable - vsphere.vsan_enable - vsphere.wraps - webutil.useradd - webutil.userdel - webutil.verify - xfs.defragment - xfs.devices - xfs.dump - xfs.estimate - xfs.info - xfs.inventory - xfs.mkfs - xfs.modify - xfs.prune_dump - zabbix.apiinfo_version - zabbix.compare_params - zabbix.configuration_import - zabbix.get_object_id_by_params - zabbix.get_zabbix_id_mapper - zabbix.host_create - zabbix.host_delete - zabbix.host_exists - zabbix.host_get - zabbix.host_inventory_get - zabbix.host_inventory_set - zabbix.host_list - zabbix.host_update - zabbix.hostgroup_create - zabbix.hostgroup_delete - zabbix.hostgroup_exists - zabbix.hostgroup_get - zabbix.hostgroup_list - zabbix.hostgroup_update - zabbix.hostinterface_create - zabbix.hostinterface_delete - zabbix.hostinterface_get - zabbix.hostinterface_update - zabbix.mediatype_create - zabbix.mediatype_delete - zabbix.mediatype_get - zabbix.mediatype_update - zabbix.run_query - zabbix.substitute_params - zabbix.template_get - zabbix.user_addmedia - zabbix.user_create - zabbix.user_delete - zabbix.user_deletemedia - zabbix.user_exists - zabbix.user_get - zabbix.user_getmedia - zabbix.user_list - zabbix.user_update - zabbix.usergroup_create - zabbix.usergroup_delete - zabbix.usergroup_exists - zabbix.usergroup_get - zabbix.usergroup_list - zabbix.usergroup_update - zabbix.usermacro_create - zabbix.usermacro_createglobal - zabbix.usermacro_delete - zabbix.usermacro_deleteglobal - zabbix.usermacro_get - zabbix.usermacro_update - zabbix.usermacro_updateglobal - zenoss.add_device - zenoss.device_exists - zenoss.find_device - zenoss.set_prod_state [root@master ~]#
c、较详细的查看salt某一个模块信息(例如status) salt 'node01' sys.list_functions status
[root@master ~]# salt 'node01' sys.list_functions status node01: - status.all_status - status.cpuinfo - status.cpustats - status.custom - status.diskstats - status.diskusage - status.loadavg - status.master - status.meminfo - status.netdev - status.netstats - status.nproc - status.pid - status.ping_master - status.procs - status.proxy_reconnect - status.time - status.uptime - status.version - status.vmstats - status.w
d、详细查看salt内置模块,带例样 salt 'node01' sys.doc
[root@master ~]# salt 'node01' sys.doc | more acl.delfacl: Remove specific FACL from the specified file(s) CLI Examples: 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.delfacl user myuser /tmp/house/kitchen recursive=True acl.getfacl: Return (extremely verbose) map of FACLs on specified file(s) CLI Examples: salt '*' acl.getfacl /tmp/house/kitchen salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom recursive=True acl.modfacl: Add or modify a FACL for the specified file(s) CLI Examples: salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen salt '*' acl.modfacl default:group mygroup rx /tmp/house/kitchen salt '*' acl.modfacl d:u myuser 7 /tmp/house/kitchen salt '*' acl.modfacl g mygroup 0 /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen recursive=True salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen raise_err=True acl.version: Return facl version from getfacl --version CLI Example: salt '*' acl.version acl.wipefacls: Remove all FACLs from the specified file(s) CLI Examples: salt '*' acl.wipefacls /tmp/house/kitchen salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom recursive=True aliases.get_target: Return the target associated with an alias CLI Example: salt '*' aliases.get_target alias aliases.has_target: Return true if the alias/target is set CLI Example: salt '*' aliases.has_target alias target aliases.list_aliases: Return the aliases found in the aliases file in this format:: {'alias': 'target'} CLI Example: salt '*' aliases.list_aliases aliases.rm_alias: Remove an entry from the aliases file CLI Example: salt '*' aliases.rm_alias alias aliases.set_target: Set the entry in the aliases file for the given alias, this will overwrite any previous entry for the given alias or create a new one if it does not exist. CLI Example: salt '*' aliases.set_target alias target alternatives.auto: Trigger alternatives to set the path for <name> as specified by priority. CLI Example: salt '*' alternatives.auto name alternatives.check_exists: Check if the given path is an alternative for a name. New in version 2015.8.4 CLI Example: salt '*' alternatives.check_exists name path alternatives.check_installed: Check if the current highest-priority match for a given alternatives link is set to the desired path CLI Example: salt '*' alternatives.check_installed name path alternatives.display: Display alternatives settings for defined command name CLI Example: salt '*' alternatives.display editor alternatives.install: Install symbolic links determining default commands CLI Example: salt '*' alternatives.install editor /usr/bin/editor /usr/bin/emacs23 50 alternatives.remove: Remove symbolic links determining the default commands. CLI Example: salt '*' alternatives.remove name path alternatives.set: Manually set the alternative <path> for <name>. CLI Example: salt '*' alternatives.set name path 略
详细查看salt内置某一个模块(例如status),带样例 salt 'node01' sys.doc status
[root@master ~]# salt 'node01' sys.doc | more acl.delfacl: Remove specific FACL from the specified file(s) CLI Examples: 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.delfacl user myuser /tmp/house/kitchen recursive=True acl.getfacl: Return (extremely verbose) map of FACLs on specified file(s) CLI Examples: salt '*' acl.getfacl /tmp/house/kitchen salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom recursive=True acl.modfacl: Add or modify a FACL for the specified file(s) CLI Examples: salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen salt '*' acl.modfacl default:group mygroup rx /tmp/house/kitchen salt '*' acl.modfacl d:u myuser 7 /tmp/house/kitchen salt '*' acl.modfacl g mygroup 0 /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen recursive=True salt '*' acl.modfacl user myuser rwx /tmp/house/kitchen raise_err=True acl.version: Return facl version from getfacl --version CLI Example: salt '*' acl.version acl.wipefacls: Remove all FACLs from the specified file(s) CLI Examples: salt '*' acl.wipefacls /tmp/house/kitchen salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.wipefacls /tmp/house/kitchen /tmp/house/livingroom recursive=True aliases.get_target: Return the target associated with an alias CLI Example: salt '*' aliases.get_target alias aliases.has_target: Return true if the alias/target is set CLI Example: salt '*' aliases.has_target alias target aliases.list_aliases: Return the aliases found in the aliases file in this format:: {'alias': 'target'} CLI Example: salt '*' aliases.list_aliases aliases.rm_alias: Remove an entry from the aliases file CLI Example: salt '*' aliases.rm_alias alias aliases.set_target: Set the entry in the aliases file for the given alias, this will overwrite any previous entry for the given alias or create a new one if it does not exist. CLI Example: salt '*' aliases.set_target alias target alternatives.auto: Trigger alternatives to set the path for <name> as specified by priority. CLI Example: salt '*' alternatives.auto name alternatives.check_exists: Check if the given path is an alternative for a name. New in version 2015.8.4 CLI Example: salt '*' alternatives.check_exists name path alternatives.check_installed: Check if the current highest-priority match for a given alternatives link is set to the desired path CLI Example: salt '*' alternatives.check_installed name path alternatives.display: Display alternatives settings for defined command name CLI Example: salt '*' alternatives.display editor alternatives.install: Install symbolic links determining default commands CLI Example: salt '*' alternatives.install editor /usr/bin/editor /usr/bin/emacs23 50 alternatives.remove: Remove symbolic links determining the default commands. CLI Example: salt '*' alternatives.remove name path alternatives.set: Manually set the alternative <path> for <name>. CLI Example: salt '*' alternatives.set name path alternatives.show_current: Display the current highest-priority alternative for a given alternatives [root@master ~]# salt 'node01' sys.doc status status.all_status: Return a composite of all status data and info for this minion. Warning: There is a LOT here! CLI Example: salt '*' status.all_status status.cpuinfo: Changed in version 2016.3.2 Return the CPU info for this minion Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for NetBSD and OpenBSD CLI Example: salt '*' status.cpuinfo status.cpustats: Return the CPU stats for this minion Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for OpenBSD CLI Example: salt '*' status.cpustats status.custom: Return a custom composite of status data and info for this minion, based on the minion config file. An example config like might be:: status.cpustats.custom: [ 'cpu', 'ctxt', 'btime', 'processes' ] Where status refers to status.py, cpustats is the function where we get our data, and custom is this function It is followed by a list of keys that we want returned. This function is meant to replace all_status(), which returns anything and everything, which we probably don't want. By default, nothing is returned. Warning: Depending on what you include, there can be a LOT here! CLI Example: salt '*' status.custom status.diskstats: Changed in version 2016.3.2 Return the disk stats for this minion Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.diskstats status.diskusage: Return the disk usage for this minion Usage:: salt '*' status.diskusage [paths and/or filesystem types] CLI Example: 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 status.loadavg: Return the load averages for this minion Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.loadavg :raises CommandExecutionError: If the system cannot report loadaverages to Python status.master: New in version 2014.7.0 Return the connection status with master. Fire an event if the connection to master is not as expected. This function is meant to be run via a scheduled job from the minion. If master_ip is an FQDN/Hostname, it must be resolvable to a valid IPv4 address. Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.master status.meminfo: Return the memory info for this minion Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for OpenBSD CLI Example: salt '*' status.meminfo status.netdev: Changed in version 2016.3.2 Return the network device stats for this minion Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.netdev status.netstats: Return the network stats for this minion Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for OpenBSD CLI Example: salt '*' status.netstats status.nproc: Return the number of processing units available on this system Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for Darwin, FreeBSD and OpenBSD CLI Example: salt '*' status.nproc status.pid: Return the PID or an empty string if the process is running or not. Pass a signature to use to find the process via ps. Note you can pass a Python-compatible regular expression to return all pids of processes matching the regexp. Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.pid <sig> status.ping_master: New in version 2016.3.0 Sends ping request to the given master. Fires '__master_failback' event on success. Returns bool result. CLI Example: salt '*' status.ping_master localhost status.procs: Return the process data Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.procs status.proxy_reconnect: Forces proxy minion reconnection when not alive. proxy_name The virtual name of the proxy module. opts: None Opts dictionary. Not intended for CLI usage. CLI Example: salt '*' status.proxy_reconnect rest_sample status.time: New in version 2016.3.0 Return the current time on the minion, formatted based on the format parameter. Default date format: Monday, 27. July 2015 07:55AM CLI Example: salt '*' status.time salt '*' status.time '%s' status.uptime: Return the uptime for this system. Changed in version 2015.8.9 The uptime function was changed to return a dictionary of easy-to-read key/value pairs containing uptime information, instead of the output from a ``cmd.run`` call. Changed in version 2016.11.0 Support for OpenBSD, FreeBSD, NetBSD, MacOS, and Solaris Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.uptime status.version: Return the system version for this minion Changed in version 2016.11.4 Added support for AIX Changed in version 2018.3.0 Added support for OpenBSD CLI Example: salt '*' status.version status.vmstats: Changed in version 2016.3.2 Return the virtual memory stats for this minion Changed in version 2016.11.4 Added support for AIX CLI Example: salt '*' status.vmstats status.w: Return a list of logged in users for this minion, using the w command CLI Example: salt '*' status.w [root@master ~]#
10、刷新Pillar数据 (更新 /srv/pillar/base/ 中数据文件信息需要更新同步到minion端)
[root@master ~]# salt '*' saltutil.refresh_pillar node01: True master: True [root@master ~]#
11、获得所有或者指定pillar数据信息
salt '*' pillar.items
salt ’*‘ pillar.item uuid
salt '*' pillar.get uuid
12、刷新grains数据信息 salt '*' saltutil.sync_grains
[root@master pillar]# salt '*' grains.item roles node01: ---------- roles: node02: ---------- roles: - webserver - dbserver master: ---------- roles: [root@master pillar]# salt '*' saltutil.sync_grains node02: node01: master: [root@master pillar]# salt '*' grains.item roles node01: ---------- roles: - webserver node02: ---------- roles: - webserver - dbserver master: ---------- roles:
13、获得指定grains数据信息
salt '*' grains.items
salt ’*‘ grains.item uuid
salt '*' grains.get uuid