1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/examples/playbooks/loop_with_items.yml

31 lines
590 B
YAML
Raw Normal View History

---
# 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:
2013-05-05 19:39:03 +02:00
- name: install packages
action: yum name={{ item }} state=installed
with_items:
- cobbler
- httpd
2013-05-05 19:39:03 +02:00
- name: configure users
action: user name={{ item }} state=present groups=wheel
with_items:
- testuser1
- testuser2
2013-05-05 19:39:03 +02:00
- name: remove users
action: user name={{ item }} state=absent
with_items:
- testuser1
- testuser2