Let’s say i have host groups defined in my inventory file as follows:
[group1]
serverA
[group2]
serverB
and i have a playbook called existing.yml that has hosts variable defined for host in group1:
Let’s say i have host groups defined in my inventory file as follows:
[group1]
serverA
[group2]
serverB
and i have a playbook called existing.yml that has hosts variable defined for host in group1:
Let's say i have host groups defined in my inventory file as follows:
[group1]
serverA[group2]
serverBand i have a playbook called existing.yml that has hosts variable defined for host in group1:
---
- hosts: group1
tags: installtasks:
- module ...Can i include existing.yml in another play but for a different host? I have tried something like this:
---
- import_playbook: existing.yml
hosts: group2but this fails. What is the best way to call an existing playbook for a different host than the host defined inside the
called play?
Hello Michael,
it is always useful to explain the background of your task in order to get better answers.
You could use multiple plays in your playbook:
- hosts: group1
tasks:
- hosts: group2
tasks:
Regards
Racke
Please provide more info and include your errors so that we can get idea to debug more on this