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