diff --git a/roles/mongodb/tasks/main.yml b/roles/mongodb/tasks/main.yml index 235f420..00e6693 100644 --- a/roles/mongodb/tasks/main.yml +++ b/roles/mongodb/tasks/main.yml @@ -203,6 +203,7 @@ login_user: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" database: "{{ mongo_admin_db_name }}" name: admin password: "{{ mongo_user_admin_password }}" @@ -222,6 +223,7 @@ login_user: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" database: "{{ mongo_itential_db_name }}" user: itential password: "{{ mongo_user_itential_password }}" @@ -241,6 +243,7 @@ login_user: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongodb_auth_enabled is defined and mongodb_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" database: "{{ mongo_localaaa_db_name }}" user: localaaa password: "{{ mongo_user_localaaa_password }}" diff --git a/roles/mongodb_common/tasks/check-auth-status.yml b/roles/mongodb_common/tasks/check-auth-status.yml index 13f4b2f..f480f42 100644 --- a/roles/mongodb_common/tasks/check-auth-status.yml +++ b/roles/mongodb_common/tasks/check-auth-status.yml @@ -13,6 +13,7 @@ login_user: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" mongo_cmd: auto db: admin eval: "db.getUsers()" diff --git a/roles/mongodb_common/tasks/determine-primary-server.yml b/roles/mongodb_common/tasks/determine-primary-server.yml index 1fb6dd0..ed81216 100644 --- a/roles/mongodb_common/tasks/determine-primary-server.yml +++ b/roles/mongodb_common/tasks/determine-primary-server.yml @@ -11,6 +11,7 @@ login_user: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" eval: "rs.status()" register: rs_status_result changed_when: false @@ -31,6 +32,7 @@ login_user: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary('admin', omit) }}" login_password: "{{ mongo_auth_enabled is defined and mongo_auth_enabled | ternary(mongo_user_admin_password, omit) }}" login_port: "{{ mongo_port }}" + login_host: "{{ inventory_hostname }}" replica_set: rs0 register: mongodb_status_result