suppandi g
suppandi g

Reputation: 526

Using an ansible role to create two clusters

I want to setup 2 clusters of zookeepers. Right now I have a template in my zookeeper role that iterates through groups.zookeepers and builds the zookeeper config file to point to all the nodes in the cluster. What is the right way to write one role and still get 2 separate clusters?

Upvotes: 0

Views: 429

Answers (1)

udondan
udondan

Reputation: 59989

You can parameterize roles.

Example playbook snippet:

roles:
  - role: your_role
    cluster: A
  - role: your_role
    cluster: B

OK, after re-reding your question and above comments, I think this might be more of help:

A playbook can have multiple plays in which you can target different hosts.

- name: Cluster A
  hosts: clusterA
  roles:
    - your_role

- name: Cluster B
  hosts: clusterB
  roles:
    - your_role

Upvotes: 1

Related Questions