Have 2 hosts my_host1, my_host2 This code work for my_host1, I also need run it for my_host2 Can be overridden hosts value on ansible main.yml task without changing string "hosts: my_host1" in init playbook.yml? Command line --extra-vars is not the solution for me.
Thank you
---
#init playbook.yml
- name: run role test
hosts: my_host1
roles:
- role: test_1
---
#main.yml in role test_1
- name: Run tasks from example.yml
block:
- include_tasks: example.yml
---
# example.yml
- debug:
msg: "This is example task"