我有一本剧本,其中包含(除其他外)三个具体任务。
- 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
Run Code Online (Sandbox Code Playgroud)
问题是,如果前两个任务中的任何一个失败,我需要(作为失败过程的一部分)激活最后一个任务的逻辑(它可能作为处理程序)。我看到有阻止/救援选项,问题是如果我使用它-救援“取消”失败。我所需要的只是在失败的情况下执行启动 JBoss,但剧本仍然会失败。
有什么想法可以做到吗?
ansible ×1