官术网_书友最值得收藏!

Loops example

The following task adds users using the Jinja2 templating. This allows for dynamic functionality in playbooks. We can use variables to store data when required, we just need to update the variables rather than the entire playbook:

- name: add several users
  user:
    name: "{{ item.name }}"
    state: present
    groups: "{{ item.groups }}"
  with_items:
    - { name: 'testuser1', groups: 'wheel' }
    - { name: 'testuser2', groups: 'root' }
主站蜘蛛池模板: 潜山县| 南部县| 舟山市| 宁河县| 辽宁省| 垫江县| 宣威市| 平度市| 闻喜县| 万山特区| 枣庄市| 米林县| 嘉荫县| 高清| 安塞县| 雅安市| 洛川县| 金华市| 余庆县| 北海市| 中山市| 西贡区| 鸡西市| 胶州市| 云梦县| 东兰县| 宽城| 虎林市| 普陀区| 邵武市| 龙南县| 通山县| 衢州市| 通化市| 鄂托克旗| 文山县| 分宜县| 黄梅县| 睢宁县| 廊坊市| 花莲县|