I need to be able to do this from a single playbook. What if I create a
task that is a shell command that calls into ansible-playbook on a
different playbook?
-Tristan
On Friday, September 23, 2016 at 5:48:57 PM UTC-7, Brian Coca wrote:
>
> you don't, you create a new play that targets those
How do I change hosts when including tasks from another playbook? I've
tried both methods I could find below, but neither seems to work:
- name: example
hosts: localhost
tasks:
- name: execute this task
include: tasks/task1.yml
hosts: "{{ name }}.example.com"
- name:
I understand that, but it seems that each play can't have a different hosts
set. That is, I would like the first play to have "localhost" as the hosts
and the second play to have hosts dynamically set to whatever the first
play says it is.
-Tristan
On Friday, September 23, 2016 at 8:28:31
I tried this and it isn't working as expected:
test.yml
---
- include: 1.yml
when: type == '1'
- include: 2.yml
when: type == '2'
1.yml
---
- name: "1"
hosts: localhost
tasks:
- debug: msg="1"
2.yml
---
- name: "2"
hosts: localhost
tasks:
- debug: msg="2"
Command:
Is there an alternative solution to get the behavior I'd like?
-Tristan
On Wednesday, September 21, 2016 at 5:08:35 PM UTC-7, Brian Coca wrote:
>
> playbooks cannot be included conditionally.
>
>
> --
> Brian Coca
>
--
You received this message because you are subscribed to the Google
osts: "new-play-hosts"
tasks:
- local_action: debug var=play_hosts
-Tristan
On Friday, September 30, 2016 at 10:07:21 AM UTC-7, Kai Stian Olstad wrote:
>
> On 30. sep. 2016 02:30, Tristan Muntsinger wrote:
> > Using your example (and replacing 'a1' with the host I care about)
, it
works as expected.
-Tristan
On Monday, September 26, 2016 at 11:51:18 AM UTC-7, Kai Stian Olstad wrote:
>
> On 26. sep. 2016 19:53, Tristan Muntsinger wrote:
> > I understand that, but it seems that each play can't have a different
> hosts
> > set. That is, I woul