Kapitel 10: Ablauf
This commit is contained in:
parent
0a1a5d3440
commit
24175456ff
17
10/block.yml
Normal file
17
10/block.yml
Normal 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"'
|
||||
|
17
10/block_01_kein_Problem.yml
Normal file
17
10/block_01_kein_Problem.yml
Normal 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"'
|
||||
|
17
10/block_02_Fehler_Block.yml
Normal file
17
10/block_02_Fehler_Block.yml
Normal 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"'
|
||||
|
17
10/block_03_Fehler_Block_und_Rescue.yml
Normal file
17
10/block_03_Fehler_Block_und_Rescue.yml
Normal 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"'
|
||||
|
17
10/block_04_Fehler_nur_Rescue.yml
Normal file
17
10/block_04_Fehler_nur_Rescue.yml
Normal 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"'
|
||||
|
19
10/block_09_Fehler_Block_und_Always.yml
Normal file
19
10/block_09_Fehler_Block_und_Always.yml
Normal 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"'
|
||||
|
32
10/playbook_pre_post_tasks_roles_handlers.yml
Normal file
32
10/playbook_pre_post_tasks_roles_handlers.yml
Normal 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"
|
||||
|
35
10/playbook_pre_post_tasks_roles_handlers_really.yml
Normal file
35
10/playbook_pre_post_tasks_roles_handlers_really.yml
Normal 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"
|
||||
|
4
roles/schritt2/handlers/main.yml
Normal file
4
roles/schritt2/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Handler Schritt 2
|
||||
debug: msg="Handler Schritt 2"
|
||||
|
3
roles/schritt2/tasks/main.yml
Normal file
3
roles/schritt2/tasks/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- debug: msg="Schritt 2"
|
||||
notify: Handler Schritt 2
|
4
roles/schritt2really/handlers/main.yml
Normal file
4
roles/schritt2really/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Handler Schritt 2
|
||||
debug: msg="Handler Schritt 2"
|
||||
|
4
roles/schritt2really/tasks/main.yml
Normal file
4
roles/schritt2really/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- debug: msg="Schritt 2"
|
||||
changed_when: True
|
||||
notify: Handler Schritt 2
|
Loading…
Reference in a new issue