Host related problem

Hello,
I just starte to use ansible, now there is a question , when during the batch execution of the playbook, some operations are performed only on one of the hosts. How do you avoid other hosts on a piaybook while performing these operations?

For example,:
I will perform batch execution operations on three hosts, A,B and C, and some of them will only be executed in A. How to do this

You can pick only one host as below example.

[webservers]
A
B
C

You can just pick host A by using

hosts: groups[‘webservers’][0]

In your playbook.

  • Thank you. I’ll try

skd…@126.com於 2019年3月26日星期二 UTC+8上午10時17分38秒寫道:

Please check your loop properly. Possible the loop may have some logical issues.

Thanks & Regards,

Vaibhav Singh

+91-8976871109