mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
581 B
YAML
31 lines
581 B
YAML
13 years ago
|
---
|
||
|
# 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
|
||
|
|
||
|
|
||
|
|