Ansible使用介绍

72课时
1.9K学过
8分

课程评价 (0)

请对课程作出评价:
0/300

学员评价

暂无精选评价
2分钟

11 示例2:使用迭代创建组

vim testitem2.yml

– hosts: all

remote_user: root

tasks:

– name: create some groups

group: name={{ item }}

when: ansible_distribution_major_version == “7”

with_items:

​ – g1

​ – g2

​ – g3

执行结果:当系统版本为CentOS7时,创建g1,g2,g3组