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

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' }
主站蜘蛛池模板: 阜新市| 康马县| 新沂市| 福鼎市| 丰县| 林周县| 广饶县| 科尔| 剑阁县| 右玉县| 拉萨市| 平湖市| 云龙县| 滨州市| 喜德县| 山丹县| 寿宁县| 乌审旗| 射洪县| 色达县| 忻州市| 集安市| 泰来县| 尉氏县| 定陶县| 上蔡县| 新宁县| 留坝县| 丰顺县| 锦屏县| 来凤县| 永州市| 黎平县| 辽源市| 鄯善县| 元江| 观塘区| 比如县| 四会市| 高青县| 尼玛县|