On 05. juli 2017 16:20, Marcus Karlsson wrote:
In my project, where we install Splunk with the help of terraform and
ansible, we ran into some "errors" where we had the ansible playbook run on
3 hosts installing a search head in Splunk.

I'm a bit confused.
Here you describe one playbook with 3 hosts, but you subject has parallel paybooks, aka more than one playbook.


On of the tasks were to
configure one of these hosts as a captain. In this case, the task was given
a list on members of a cluster if the count was 0, otherwise it was given
an empty list. The problem was that since there is no garantuee that the
playbooks will finish at the same time, that task got excecuted before the
other cluster members were up and running (restarting them in some of the
tasks). So, our solution was to break out that task into a new playbook
(which seams like half arsed solution in a way, but it worked).

This is also somewhat confusing I think we need defined what is what.

A playbook is a yaml-file. This playbook can have multiple plays.

playbook.yml
--
- name: This is one play
  hosts: all
  tasks:
    - debug: msg="Test"

- name: This is another play
  hosts: all
  tasks:
    - debug: msg="Test"

This file is one playbook with two plays.

Default Ansible run first task on all the host, when that task is finished it run the next task on all the hosts....


Have I missed something in ansible documentation about some task or module
that handles this kind of problem? Like a hold_and_wait for condition?
Is there a way to let playbooks run in parallell with each other, but with
a condition to continue if all playbooks reach a specific task and then
continue?

Ansible has modules that does wait, but hard to recommend since I don't understand you problem.


I dont know if this was the best explanation of the problem but, ask if
there is any uncertanties in what I mean!

Maybe it's time to show some code that might explain the problem more easily.

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ede0df1-8c0c-50ca-0386-7596bc19d78b%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to