26 lines
532 B
YAML
26 lines
532 B
YAML
|
---
|
||
|
- hosts: localhost
|
||
|
gather_facts: no
|
||
|
|
||
|
tasks:
|
||
|
- name: Variable muss definiert sein
|
||
|
assert:
|
||
|
that:
|
||
|
- username is defined
|
||
|
|
||
|
- name: Rufe grep auf
|
||
|
command: 'grep {{ username }} /etc/passwd'
|
||
|
register: result
|
||
|
ignore_errors: True
|
||
|
|
||
|
- name: "{{ username }} existiert"
|
||
|
debug:
|
||
|
msg: '{{ username }} exists'
|
||
|
when: result is success
|
||
|
|
||
|
- name: "{{ username }} existiert nicht"
|
||
|
debug:
|
||
|
msg: '{{ username }} does not exist'
|
||
|
when: result is failed
|
||
|
|