Some commonly used commands in SaltStack

The following are some commonly used commands in SaltStack:

  1. View help information:salt --help
  2. Check Salt supported operating systems:salt '*' test.ping
  3. Check the version number of Minion:salt '*' test.version
  4. Excuting an order:salt '*' cmd.run 'command'
  5. Install the package:salt '*' pkg.install 'package_name'
  6. Upgrade package:salt '*' pkg.upgrade
  7. Remove the package:salt '*' pkg.remove 'package_name'
  8. List installed packages:salt '*' pkg.list_pkgs
  9. Check the system load:salt '*' status.loadavg
  10. Check memory usage:salt '*' status.meminfo
  11. Check hard drive usage:salt '*' status.diskusage
  12. View CPU information:salt '*' status.cpuinfo
  13. Restart Minion:salt '*' system.reboot
  14. Close Minion:salt '*' system.shutdown
  15. Get Minion’s network interface information:salt '*' network.interfaces
  16. Get the Minion’s IP address:salt '*' network.ip_addrs
  17. Get the Minion’s hostname:salt '*' network.get_hostname
  18. synchronised time:salt '*' system.set_date
  19. Check service status:salt '*' service.status 'service_name'
  20. Start the service:salt '*' service.start 'service_name'
  21. Out of service:salt '*' service.stop 'service_name'
  22. Restart the service:salt '*' service.restart 'service_name'
  23. Reload the configuration file:salt '*' service.reload 'service_name'
  24. Check the status of the Minion:salt '*' status.status
  25. Run the Grains module:salt '*' grains.ls
  26. Check the Minion’s IP address:salt '*' grains.get ipv4
  27. Check Minion’s operating system:salt '*' grains.get os
  28. View Minion’s CPU information:salt '*' grains.get cpu_model
  29. Set Minion’s custom variables:salt '*' grains.setval 'custom_var' 'value'
  30. Synchronize Grains information:salt '*' saltutil.sync_grains
  31. Execute custom module:salt '*' mymodule.run
  32. Execute State file:salt '*' state.apply 'state_file'
  33. Check the State file for invalid configuration:salt '*' state.show_highstate
  34. Verify State file syntax:salt '*' state.show_sls 'state_file'
  35. View the Highstate file:salt '*' state.show_highstate
  36. Apply Highstate file:salt '*' state.highstate
  37. Check out Minion’s Mine function:salt '*' mine.get 'target_minion' 'mine_function'
  38. Refresh Mine function:salt '*' mine.flush
  39. View execution results:salt '*' jobs.active
  40. To forcefully terminate a job:salt '*' saltutil.kill_job 'job_id'
  41. Execute remote execution command:salt-cp '*' '/path/to/source.file' '/path/to/destination.file'
  42. Copy files to Minion:salt-cp '*' '/path/to/source.file' '/path/to/destination.file'
  43. Copy files to Salt Master:salt-cp '*' '/path/to/source.file' 'salt://destination.file'
  44. Install the extension module:salt '*' saltutil.sync_all
  45. Add new Minions:salt-key -a 'new_minion'
  46. Remove an offline Minion:salt-key -d 'offline_minion'
  47. List accepted minions:salt-key -L
  48. List rejected minions:salt-key -R
  49. List Minions waiting to be accepted:salt-key -P
  50. Check the status of Salt Master:salt-run manage.status
  51. Synchronize the keys of all Minions:salt-run manage.up
  52. List all Minions on the Master:salt-run manage.present
  53. List unconnected Minions:salt-run manage.down
  54. Perform grayscale publishing:salt-run cache.grains 'grain_key:grain_value'
  55. Send events to the event bus:salt-call event.send 'event_tag' data='event_data'
  56. View events on the event bus:salt-run event.fire_master 'event_tag' data='event_data'
  57. Run the scheduled task:salt-cron '*' enable_job <job_name>
  58. Disable scheduled tasks:salt-cron '*' disable_job <job_name>

Here are some commonly used SaltStack commands to help you with configuration management, software package management, and system management. For specific command usage and parameters, please refer to SaltStack official documentation.

Supongo que te gusta

Origin blog.csdn.net/m0_55877125/article/details/132901398
Recomendado
Clasificación