Split replication configuration without auth to fix first run ansible

on all hosts in MongoDB cluster in same time.
This commit is contained in:
Mikhail Konyakhin 2019-12-27 13:40:19 +03:00
parent 1fa78ca6da
commit d0bacd7cd2
1 changed files with 22 additions and 2 deletions

View File

@ -19,7 +19,7 @@
with_items:
- "{{ mongodb_replication_params|default([]) }}"
- name: Replication configuration without auth
- name: Replication configuration without auth on master
mongodb_replication:
build_indexes: "{{ item.build_indexes|default(omit) }}"
login_host: "{{ mongodb_login_host|default('localhost') }}"
@ -32,6 +32,26 @@
priority: "{{ item.priority|default(1.0) }}"
votes: "{{ item.votes|default(omit) }}"
ssl: "{{ True if mongodb_net_ssl_mode == 'requireSSL' else False }}"
when: mongodb_security_authorization == 'disabled'
when: ( mongodb_security_authorization == 'disabled'
and mongodb_master is defined and mongodb_master )
with_items:
- "{{ mongodb_replication_params|default([]) }}"
- name: Replication configuration without auth on replicas and arbiters
mongodb_replication:
build_indexes: "{{ item.build_indexes|default(omit) }}"
login_host: "{{ mongodb_login_host|default('localhost') }}"
login_port: "{{ mongodb_login_port|default(27017) }}"
replica_set: "{{ mongodb_replication_replset }}"
host_name: "{{ item.host_name }}"
host_port: "{{ item.host_port|default(27017) }}"
host_type: "{{ item.host_type|default('replica') }}"
hidden: "{{ item.hidden|default(false) }}"
priority: "{{ item.priority|default(1.0) }}"
votes: "{{ item.votes|default(omit) }}"
ssl: "{{ True if mongodb_net_ssl_mode == 'requireSSL' else False }}"
when: ( mongodb_security_authorization == 'disabled'
and ( mongodb_master is not defined or not mongodb_master) )
with_items:
- "{{ mongodb_replication_params|default([]) }}"