Ansible 版本:2.1.0
我的ansible主机文件是:
[PM]
xyz.example.com ansible_connection=ssh
[ND]
pqr.example.com ansible_connection=ssh
[CM]
xyz.example.com ansible_connection=ssh
pqr.example.com ansible_connection=ssh
剧本是:
- hosts: PM:ND:CM
remote_user: root
tasks:
{some thing}
- hosts: PM
remote_user: root
tasks:
{some thing}
- hosts: ND
remote_user: root
tasks:
{some thing}
- hosts: CM
remote_user: root
tasks:
{some thing}
我正在使用以下命令运行剧本:
ansible-playbook --limit 'PM' akana-installation.yml
但是剧本仍然在与所有主机一起玩,这意味着
Play 'PM:ND:CM'
Play 'PM'
Play 'ND'
Play 'CM'
所有戏剧都在播放。请帮我解决这个问题。
我需要的是:在执行剧本时,我会给出组名,只有那个组应该玩,所以请让我知道还有其他方法。