On 30. okt. 2017 21:12, Aleks Przhelyaskovskiy wrote:
> Hello,
> 
> Trying to setup rolling deployments for WAS using ansible core.
> 
> My environment consists of two groups of hosts. Each group has one manager,
> and two nodes. The deployment process consists of running a task on manager
> host first, and then another tasks on every node in the group (including
> manager). I'd like to run the whole deployment process one group at-a-time.

You have a few options, one of them is something like this.


inventory
---------
[group1]
manager1
host1
host2

[group2]
manager2
host3
host4


playbook.yml
---
- hosts: group1
  tasks:
    - name: Only run on manager
      debug: msg='I'm running on manager'
      when: inventory_hostname == manager1

    - name: Run on all host in group
      debug: msg="I'm running on all hosts"

- hosts: group2
  tasks:
    - name: Only run on manager
      debug: msg='I'm running on manager'
      when: inventory_hostname == manager2

    - name: Run on all host in group
      debug: msg="I'm running on all hosts"



-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eacb91dd-2a77-37dc-cb1d-69743deb59cf%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to