Bo's Oracle Station

查看: 2227|回复: 0

ansible7(有矩阵结构的变量)

[复制链接]

75

主题

115

帖子

2772

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2772
发表于 2020-12-12 21:26:43 | 显示全部楼层 |阅读模式
v5-2_srvgroup.yml:

  1. ---
  2. - name: Users Exist and Are in the Correct Groups
  3.   hosts: srvgroup
  4.   tasks:
  5.   - name: User and Group
  6.     user:
  7.       name: "{{ item.name }}"
  8.       state: present
  9.       groups: "{{ item.group }}"
  10.     loop:
  11.       - name: alex
  12.         group: wheel
  13.       - name: natasha
  14.         group: root
复制代码
  1. ---
  2. - name: Users Exist and Are in the Correct Groups
  3.   hosts: srvgroup
  4.   tasks:
  5.   - name: User and Group
  6.     user:
  7.       name: "{{ item.name }}"
  8.       state: present
  9.       groups: "{{ item.group }}"
  10.     loop:
  11.       - name: alex
  12.         group: wheel
  13.       - name: natasha
  14.         group: root

  15.   - name: Display
  16.     debug:
  17.       msg: "{{ item.name }}"
  18.     loop:
  19.       - name: alex
  20.         group: wheel
  21.       - name: natasha
  22.         group: root
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-11-21 14:23 , Processed in 0.043964 second(s), 24 queries .

快速回复 返回顶部 返回列表