Skip to content

Commit 1a8aa6d

Browse files
committed
Use bindip for mongodb_user
Fixes #103
1 parent 68e62d3 commit 1a8aa6d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

molecule/default/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ provisioner:
3535
host_vars:
3636
mongo1:
3737
ansible_python_interpreter: auto_silent
38+
mongodb_net_bindip: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }},127.0.0.1"
3839
mongodb_master: true
3940
mongodb_replication_params:
4041
- host_name: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"

tasks/auth_initialization.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
password: "{{ item.password }}"
2121
update_password: "{{ mongodb_user_update_password }}"
2222
roles: "{{ item.roles }}"
23+
login_host: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list | first }}"
2324
login_port: "{{ mongodb_net_port | int }}"
2425
with_items:
2526
- {
@@ -36,6 +37,7 @@
3637
password: "{{ item.password }}"
3738
update_password: "{{ mongodb_user_update_password }}"
3839
roles: "{{ item.roles }}"
40+
login_host: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list | first }}"
3941
login_port: "{{ mongodb_net_port | int }}"
4042
with_items:
4143
- {
@@ -52,6 +54,7 @@
5254
password: "{{ item.password }}"
5355
update_password: "{{ mongodb_user_update_password }}"
5456
roles: "{{ item.roles }}"
57+
login_host: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list | first }}"
5558
login_port: "{{ mongodb_net_port | int }}"
5659
with_items:
5760
- {

0 commit comments

Comments
 (0)