-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandling-errors-test5.yml
84 lines (68 loc) · 1.63 KB
/
handling-errors-test5.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- hosts: grupo2
become: true
tasks:
- block:
- name: install httpd
yum:
name: httpdAAAA
state: latest
register: instalacion
- debug: var=instalacion
- name: notificar si se instalo
shell: echo " "
notify: instalacion_si
rescue:
- name: recue
shell: echo ""
notify: install_fail
- block:
- name: servicio
systemd:
name: httpdAAAA
state: started
enabled: true
register: servicio
- name: debug
debug:
var: servicio
- name: notificar
shell: echo ""
notify: service_start
rescue:
- name: rescue
shell: echo " "
notify: service_fail
- block:
- name: instalacion y servicio ok
shell: echo " "
notify: ambos_ok
when: "not instalacion|failed and 'state' in servicio"
- name: instalacion y servicios no
shell: echo " "
notify: ambos_no
when: "instalacion|failed and 'state' not in servicio"
handlers:
- name: ambos_ok
debug:
msg: "INSTALACION Y SERVICIOS OK"
- name: ambos_no
debug:
msg: "instalacion y servicios fail"
- name: restart apache
systemd:
name: httpd
state: restarted
- name: install_fail
debug:
msg: "Instalacion Fallo - Intenta Nuevamente"
- name: instalacion_si
debug:
msg: "Instalacion con exito"
- name: service_start
debug:
msg: "Servicio inicio"
- name: service_fail
debug:
msg: "Servicio NO inicio"
...