mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
30 lines
581 B
YAML
30 lines
581 B
YAML
---
|
|
# this is an example of how to run repeated task elements over lists
|
|
# of items, for example, installing multiple packages or configuring
|
|
# multiple users
|
|
|
|
- hosts: all
|
|
user: root
|
|
|
|
tasks:
|
|
|
|
- name: install $item
|
|
action: yum pkg=$item state=installed
|
|
with_items:
|
|
- cobbler
|
|
- httpd
|
|
|
|
- name: configure user $item
|
|
action: user name=$item state=present groups=wheel
|
|
with_items:
|
|
- testuser1
|
|
- testuser2
|
|
|
|
- name: remove user $item
|
|
action: user name=$item state=absent
|
|
with_items:
|
|
- testuser1
|
|
- testuser2
|
|
|
|
|
|
|