summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/mongodb/roles/mongodb_auth
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:27 +0000
commit3b0807ad7b283c46c21862eb826dcbb4ad04e5e2 (patch)
tree6461ea75f03eca87a5a90c86c3c9a787a6ad037e /ansible_collections/community/mongodb/roles/mongodb_auth
parentAdding debian version 7.7.0+dfsg-3. (diff)
downloadansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.tar.xz
ansible-3b0807ad7b283c46c21862eb826dcbb4ad04e5e2.zip
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/mongodb/roles/mongodb_auth')
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_auth/defaults/main.yml2
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/molecule.yml4
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/playbook.yml15
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_auth/tasks/main.yml2
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_auth/tasks/mongodb_auth_user.yml2
5 files changed, 21 insertions, 4 deletions
diff --git a/ansible_collections/community/mongodb/roles/mongodb_auth/defaults/main.yml b/ansible_collections/community/mongodb/roles/mongodb_auth/defaults/main.yml
index c34225a2a..59049bde2 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_auth/defaults/main.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_auth/defaults/main.yml
@@ -26,3 +26,5 @@ mongodb_users: []
# Setting this to yes will result in 'changed' on every run, even if the password is the same.
# See the comment in tasks/main.yml for more details.
mongodb_force_update_password: no
+
+mongodb_use_tls: false \ No newline at end of file
diff --git a/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/molecule.yml b/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/molecule.yml
index 8b614fb6a..dfb11aac4 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/molecule.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/molecule.yml
@@ -15,8 +15,8 @@ platforms:
privileged: True
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- - name: ubuntu_18
- image: ubuntu:18.04
+ - name: ubuntu_22_04
+ image: ubuntu:22.04
command: /sbin/init
privileged: True
- name: ubuntu_22
diff --git a/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/playbook.yml b/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/playbook.yml
index 46c4e8e2e..efbb70469 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/playbook.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_auth/molecule/default/playbook.yml
@@ -9,7 +9,7 @@
# initially disable authorization on some hosts
hosts_with_auth_disabled:
- - ubuntu_18
+ - ubuntu_22_04
- ubuntu_22
# add some users for some of the hosts
@@ -52,6 +52,17 @@
include_role:
name: mongodb_auth
+ - name: Determine openssl version
+ command: openssl version
+ changed_when: false
+ register: openssl
+
+ - name: Set mongosh package version
+ set_fact:
+ mongosh_package: "{{ 'mongodb-mongosh-shared-openssl3' if openssl.stdout.startswith('OpenSSL 3') else 'mongodb-mongosh-shared-openssl11' }}"
+ when: mongosh_package is not defined
+
- name: Install MongoDB Shell
package:
- name: mongodb-mongosh
+ name:
+ - "{{ mongosh_package }}"
diff --git a/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/main.yml b/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/main.yml
index d3775a1b7..eff6e4f31 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/main.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/main.yml
@@ -94,6 +94,8 @@
database: admin
roles: "{{ mongodb_admin_roles }}"
+ ssl: "{{ mongodb_use_tls }}"
+ ssl_ca_certs: "{{ mongodb_certificate_ca_file if mongodb_use_tls else omit }}"
login_host: localhost
login_port: "{{ mongod_port | string }}" # silence implicit int->str conversion warning
create_for_localhost_exception: /root/mongodb_admin.success
diff --git a/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/mongodb_auth_user.yml b/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/mongodb_auth_user.yml
index e21dec073..5c0c930ba 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/mongodb_auth_user.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_auth/tasks/mongodb_auth_user.yml
@@ -18,6 +18,8 @@
database: "{{ _mongodb_user.db }}"
roles: "{{ _mongodb_user.roles|default('readWrite') }}"
+ ssl: "{{ mongodb_use_tls }}"
+ ssl_ca_certs: "{{ mongodb_certificate_ca_file if mongodb_use_tls else omit }}"
login_host: localhost
login_port: "{{ mongod_port | string }}" # silence implicit int->str conversion warning
login_user: "{{ mongodb_admin_user }}"