Kapitel 10: Ablauf

This commit is contained in:
Sven Velt 2024-11-28 15:26:24 +01:00
parent 0a1a5d3440
commit 24175456ff
12 changed files with 186 additions and 0 deletions

17
10/block.yml Normal file
View file

@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='OK'
- shell: /bin/false
- debug: msg='Niemals'
rescue:
- debug: msg='Im Fehlerfall'
- shell: /bin/false
- debug: msg='Niemals'
always:
- debug: msg='echo Immer'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='Block 1'
- command: /bin/true
- debug: msg='Block 2'
rescue:
- debug: msg='Rescue 1'
- command: /bin/true
- debug: msg='Rescue 2'
always:
- debug: msg='Always'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='Block 1'
- command: /bin/false
- debug: msg='Block 2'
rescue:
- debug: msg='Rescue 1'
- command: /bin/true
- debug: msg='Rescue 2'
always:
- debug: msg='Always'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='Block 1'
- command: /bin/false
- debug: msg='Block 2'
rescue:
- debug: msg='Rescue 1'
- command: /bin/false
- debug: msg='Rescue 2'
always:
- debug: msg='Always'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='Block 1'
- command: /bin/true
- debug: msg='Block 2'
rescue:
- debug: msg='Rescue 1'
- command: /bin/false
- debug: msg='Rescue 2'
always:
- debug: msg='Always'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,19 @@
---
- hosts: localhost
tasks:
- block:
- debug: msg='Block 1'
- command: /bin/false
- debug: msg='Block 2'
rescue:
- debug: msg='Rescue 1'
- command: /bin/true
- debug: msg='Rescue 2'
always:
- debug: msg='Always 1'
- command: /bin/false
- debug: msg='Always 2'
when: ansible_os_family == 'Debian'
- debug: 'msg="Nach dem Block"'

View file

@ -0,0 +1,32 @@
---
- hosts: localhost
gather_facts: False
pre_tasks:
- debug:
msg: "Schritt 1"
notify: Handler Schritt 1
roles:
- { role: schritt2 }
tasks:
- debug:
msg: "Schritt 3"
notify: Handler Schritt 3
post_tasks:
- debug:
msg: "Schritt 4"
notify: Handler Schritt 4
handlers:
- name: Handler Schritt 1
debug: msg="Handler Schritt 1"
- name: Handler Schritt 3
debug: msg="Handler Schritt 3"
- name: Handler Schritt 4
debug: msg="Handler Schritt 4"

View file

@ -0,0 +1,35 @@
---
- hosts: localhost
gather_facts: False
pre_tasks:
- debug:
msg: "Schritt 1"
changed_when: True
notify: Handler Schritt 1
roles:
- { role: schritt2really }
tasks:
- debug:
msg: "Schritt 3"
changed_when: True
notify: Handler Schritt 3
post_tasks:
- debug:
msg: "Schritt 4"
changed_when: True
notify: Handler Schritt 4
handlers:
- name: Handler Schritt 1
debug: msg="Handler Schritt 1"
- name: Handler Schritt 3
debug: msg="Handler Schritt 3"
- name: Handler Schritt 4
debug: msg="Handler Schritt 4"

View file

@ -0,0 +1,4 @@
---
- name: Handler Schritt 2
debug: msg="Handler Schritt 2"

View file

@ -0,0 +1,3 @@
---
- debug: msg="Schritt 2"
notify: Handler Schritt 2

View file

@ -0,0 +1,4 @@
---
- name: Handler Schritt 2
debug: msg="Handler Schritt 2"

View file

@ -0,0 +1,4 @@
---
- debug: msg="Schritt 2"
changed_when: True
notify: Handler Schritt 2