I have a playbook tat contains (Among other) three specfic tasks.
- name: Execute the compilation script
command: sh {{ working_folder }}/compile.sh
args:
chdir: "{{ working_folder }}"
when: run_deploy_machine == "true"
- name: Execute the deployment script
command: sh {{ working_folder }}/deploy.sh
args:
chdir: "{{ working_folder }}"
when: run_deploy_machine == "true"
- name: Start the JBoss server
shell: . /jboss start
THe problem is that if any of the first two tasks fails, I need (As part of the failure process) activate the logic of the last task (It might be as a handler). I saw that there is the block/rescue option, the problem is that if I use it- the rescue "cancel" the failure. All I need is that in case of the failure- to execute the start JBoss, but that the playbook will still fail.
Any ideas how it can be done?