正文

salt stack daily command

(2024-02-29 12:07:48) 下一个
  1. Grains Commands:

    • salt '*' grains.items: Retrieves all grain data for all minions.
    • salt '*' grains.get <grain_name>: Retrieves a specific grain for all minions.
    • salt '*' grains.ls: Lists all available grains.
  2. Execution Module Commands:

    • salt '*' cmd.run '<command>': Executes a command on all minions.
    • salt '*' cmd.shell '<command>': Executes a shell command on all minions.
    • salt '*' pkg.install <package_name>: Installs a package on all minions.
    • salt '*' service.restart <service_name>: Restarts a service on all minions.
  3. State Module Commands:

    • salt '*' state.apply <state_file_or_sls>: Applies a state file or SLS to all minions.
    • salt '*' state.highstate: Applies the highstate to all minions.
  4. Key Management Commands:

    • salt-key -L: Lists all keys.
    • salt-key -A: Accepts all pending keys.
    • salt-key -d <minion_id>: Deletes a minion's key.
  5. File Management Commands:

    • salt '*' file.managed <file_path>: Ensures that a file is present on all minions.
    • salt '*' file.get <file_path>: Retrieves a file from all minions.
    • salt '*' file.mkdir <directory_path>: Creates a directory on all minions.
  6. Grains Filtering Commands:

    • salt -G 'os:Ubuntu' test.ping: Performs a ping test on all minions matching the 'os' grain with value 'Ubuntu'.
  7. Remote Execution Commands:

    • salt '*' cmd.run '<command>': Executes a command on all minions.
    • salt-run manage.up: Lists all minions that are up.
[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.