Block aslinda bir try catch blogu gibi dene error olursa rescueyu yap sonra mutlaka always i calistir gibi.
- name: Package Installation
hosts: nodes
become: yes
tasks:
- name: Inform pipeline start
debug:
msg: "Pipeline started"
- block:
- name: Message httpd
debug:
msg: "httpd"
- name: Install httpd-wrong
yum:
name: httpd-wrong
state: present
rescue:
- name: Show error
debug:
msg: Package Not found"
- name: Install nginx
yum:
name: nginx
state: latest
always:
- name: Message
debug:
msg: "Webserver installed"