小编nus*_*ver的帖子

如何让Ansible只在一台主机上运行一个特定的任务?

剧本看起来像:

- hosts: all
  tasks:
    - name: "run on all hosts,1"
      shell: something1
    - name: "run on all hosts,2"
      shell: something2
    - name: "run on one host, any host would do"
      shell: this_command_should_run_on_one_host
    - name: "run on all hosts,3"
      shell: something3
Run Code Online (Sandbox Code Playgroud)

我知道使用命令行选项--limit,我可以限制为一个主机,是否可以在playbook中执行此操作?

ansible

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

ansible ×1