Added ansible loop example

This commit is contained in:
Michele Cereda
2022-05-08 01:42:19 +02:00
parent 3e3ea399f6
commit 6a6ee6e251

View File

@@ -123,6 +123,18 @@ ansible-galaxy remove namespace.role
var: password | password_hash('sha512', salt)
```
## Loops
```yaml
- name: Fail when one of the given variables is an empty string.
when: lookup('vars', item) == ''
ansible.builtin.fail:
msg: "The {{ item }} variable is an empty string"
loop:
- variable1
- variableN
```
## Roles
### Get roles