Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define replicaSet priority for each host? #38

Open
blair-anson opened this issue Aug 15, 2017 · 0 comments
Open

define replicaSet priority for each host? #38

blair-anson opened this issue Aug 15, 2017 · 0 comments

Comments

@blair-anson
Copy link

Is is possible to define the replicaSet priorities for each host?
The problem I have is that the host that runs the rs.initiate() command often does not become the Primary instance in the set. So running rs.reconfig() fails.
Ideally it would be great to define it as part of mongodb_conf_replSet

The playbook I'm running...

- hosts: localhost

  vars_files:
     - ./variables.yml

  roles:
    - { role: Stouts.mongodb }

  vars:
    mongodb_version: "3.2.12"
    mongodb_conf_auth: no
    mongodb_conf_dbpath: /data/db
    mongodb_conf_port: 27017
    mongodb_conf_bind_ip: 0.0.0.0
    mongodb_conf_replSet: rs0/{{ replicaSecondHost }}:27017,{{ replicaThirdHost }}:27017
    mongodb_shell:
      local:
        - rs.initiate()
        - cfg = rs.conf()
        - cfg.members[2].priority = 0
        - rs.reconfig(cfg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant