I have multiple tasks like Copy/Stop/Start so I created three yaml file based on the action. When I am passing single action then it is working fine but when I am passing two actions then playbook skipping the task.
Directory Structure.
Roles
…. App-deployment
<code> .... defaults
.... main.yaml
.... taks
.... main.yaml
.... copy.yaml
.... star.yaml
.... stop.yaml
</code>
<code> .... defaults
.... main.yaml
.... taks
.... main.yaml
.... copy.yaml
.... star.yaml
.... stop.yaml
</code>
.... defaults
.... main.yaml
.... taks
.... main.yaml
.... copy.yaml
.... star.yaml
.... stop.yaml
In the main.yaml
<code>- name: Copy jar
include_tasks: copy.yaml
when: action == 'copy'
- name: Stop sdf java jar running
include_tasks: stop.yaml
when: action == 'stop'
</code>
<code>- name: Copy jar
include_tasks: copy.yaml
when: action == 'copy'
- name: Stop sdf java jar running
include_tasks: stop.yaml
when: action == 'stop'
</code>
- name: Copy jar
include_tasks: copy.yaml
when: action == 'copy'
- name: Stop sdf java jar running
include_tasks: stop.yaml
when: action == 'stop'
In the defaults > main.yaml
<code>action: star
</code>
<code>action: star
</code>
action: star
Then it is working but when I pass two action it is not working.
In the defaults > main.yaml
<code>action: stop/start
action: stop, start
action: "stop", "start"
</code>
<code>action: stop/start
action: stop, start
action: "stop", "start"
</code>
action: stop/start
action: stop, start
action: "stop", "start"