Fixed problem with concurrency race
This commit is contained in:
parent
b387a16715
commit
77c55d557b
|
@ -66,7 +66,7 @@ script:
|
||||||
|
|
||||||
# Test 3
|
# Test 3
|
||||||
- >
|
- >
|
||||||
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
|
||||||
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
||||||
# Idempotence test
|
# Idempotence test
|
||||||
- >
|
- >
|
||||||
|
|
|
@ -42,7 +42,26 @@
|
||||||
and mongodb_user_admin_check.rc != 0 )
|
and mongodb_user_admin_check.rc != 0 )
|
||||||
tags: [mongodb]
|
tags: [mongodb]
|
||||||
|
|
||||||
- name: create normal users
|
- name: create normal users with replicaset
|
||||||
|
mongodb_user:
|
||||||
|
database: "{{ item.database }}"
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
password: "{{ item.password }}"
|
||||||
|
update_password: "{{ mongodb_user_update_password }}"
|
||||||
|
roles: "{{ item.roles }}"
|
||||||
|
login_user: "{{ mongodb_user_admin_name }}"
|
||||||
|
login_password: "{{ mongodb_user_admin_password }}"
|
||||||
|
login_port: "{{ mongodb_login_port|default(27017) }}"
|
||||||
|
login_host: "{{ mongodb_login_host|default('localhost') }}"
|
||||||
|
with_items:
|
||||||
|
- "{{ mongodb_users | default([]) }}"
|
||||||
|
when: ( mongodb_replication_replset
|
||||||
|
and mongodb_replication_replset != ''
|
||||||
|
and mongodb_security_authorization == 'enabled'
|
||||||
|
and mongodb_master is defined and mongodb_master )
|
||||||
|
tags: [mongodb]
|
||||||
|
|
||||||
|
- name: create normal users without replicaset
|
||||||
mongodb_user:
|
mongodb_user:
|
||||||
database: "{{ item.database }}"
|
database: "{{ item.database }}"
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
|
@ -52,13 +71,13 @@
|
||||||
login_user: "{{ mongodb_user_admin_name }}"
|
login_user: "{{ mongodb_user_admin_name }}"
|
||||||
login_password: "{{ mongodb_user_admin_password }}"
|
login_password: "{{ mongodb_user_admin_password }}"
|
||||||
login_port: "{{ mongodb_net_port }}"
|
login_port: "{{ mongodb_net_port }}"
|
||||||
login_database: "admin"
|
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ mongodb_users | default([]) }}"
|
- "{{ mongodb_users | default([]) }}"
|
||||||
when: mongodb_security_authorization == 'enabled'
|
when: ( mongodb_security_authorization == 'enabled'
|
||||||
|
and (not mongodb_replication_replset
|
||||||
|
or mongodb_replication_replset == '') )
|
||||||
tags: [mongodb]
|
tags: [mongodb]
|
||||||
|
|
||||||
|
|
||||||
- name: Include MMS Agent configuration
|
- name: Include MMS Agent configuration
|
||||||
include: mms-agent.yml
|
include: mms-agent.yml
|
||||||
when: mongodb_mms_api_key != ""
|
when: mongodb_mms_api_key != ""
|
||||||
|
|
|
@ -4,10 +4,10 @@ localhost ansible_connection=local ansible_python_interpreter=python2
|
||||||
[mongo_master]
|
[mongo_master]
|
||||||
mongo1 ansible_connection=docker ansible_python_interpreter=python2
|
mongo1 ansible_connection=docker ansible_python_interpreter=python2
|
||||||
|
|
||||||
[mongo_slave]
|
[mongo_replicas]
|
||||||
mongo2 ansible_connection=docker ansible_python_interpreter=python2
|
mongo2 ansible_connection=docker ansible_python_interpreter=python2
|
||||||
mongo3 ansible_connection=docker ansible_python_interpreter=python2
|
mongo3 ansible_connection=docker ansible_python_interpreter=python2
|
||||||
|
|
||||||
[mongo:children]
|
[mongo:children]
|
||||||
mongo_master
|
mongo_master
|
||||||
mongo_slave
|
mongo_replicas
|
|
@ -21,5 +21,12 @@
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
roles:
|
roles:
|
||||||
- role: greendayonfire.mongodb
|
- role: greendayonfire.mongodb
|
||||||
when: "'mongo' in group_names"
|
when: "'mongo_master' in group_names"
|
||||||
|
|
||||||
|
- hosts: "{{ target }}"
|
||||||
|
become: no
|
||||||
|
gather_facts: yes
|
||||||
|
roles:
|
||||||
|
- role: greendayonfire.mongodb
|
||||||
|
when: "'mongo_replicas' in group_names"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue