diff --git a/roles/mongodb/tasks/configure-selinux.yml b/roles/mongodb/tasks/configure-selinux.yml index 1b969e2..beb346d 100644 --- a/roles/mongodb/tasks/configure-selinux.yml +++ b/roles/mongodb/tasks/configure-selinux.yml @@ -9,14 +9,14 @@ name: selinux - name: Allow mongodb to listen on tcp port when using non-standard mongo port - when: - - ansible_selinux.status == "enabled" - - mongo_port != 27017 community.general.seport: ports: "{{ mongo_port }}" proto: tcp setype: mongod_port_t state: present + when: + - ansible_selinux.status == "enabled" + - mongo_port != 27017 # MongoDB is configured to use non-default paths for its data and log # directories. First, we need to update the SELinux policy to allow the diff --git a/roles/mongodb/tasks/main.yml b/roles/mongodb/tasks/main.yml index 968633e..235f420 100644 --- a/roles/mongodb/tasks/main.yml +++ b/roles/mongodb/tasks/main.yml @@ -200,9 +200,9 @@ # This creates the admin user that has root access to the database - name: Add admin user to database community.mongodb.mongodb_user: - login_port: "{{ mongo_port }}" 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 }}" database: "{{ mongo_admin_db_name }}" name: admin password: "{{ mongo_user_admin_password }}" @@ -219,9 +219,9 @@ # itential database. It is used by IAP to connect to the db. - name: Add itential user to database community.mongodb.mongodb_user: - login_port: "{{ mongo_port }}" 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 }}" database: "{{ mongo_itential_db_name }}" user: itential password: "{{ mongo_user_itential_password }}" @@ -238,9 +238,9 @@ # LocalAAA database. It is used by the local AAA adapter to login to IAP. - name: Add localaaa user to database community.mongodb.mongodb_user: - login_port: "{{ mongo_port }}" 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 }}" database: "{{ mongo_localaaa_db_name }}" user: localaaa password: "{{ mongo_user_localaaa_password }}"