1、打开hosts文件

vim /etc/ansible/hosts

2、定义一个主机组

[web-server]

192.168.1.1

3、定义多个组(继承)

[web:children]

web_tomcat

web_nginx

[web_tomcat]

192.168.1.1

[web_nginx]

192.168.1.1

 

此时如果运行ansible web -m ping 则下面两个子组都会执行

如果执行ansible web_nginx  -m ping 则web_nginx子组会执行

相关文章:

  • 2021-09-04
  • 2021-07-20
  • 2022-12-23
  • 2021-08-31
  • 2023-01-15
  • 2021-12-20
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案