summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/mongodb/roles/mongodb_install
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
commit7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch)
treeefb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/community/mongodb/roles/mongodb_install
parentReleasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff)
downloadansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz
ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.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_install')
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/files/lock_mongodb_packages.sh10
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/molecule.yml4
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/prepare.yml10
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/molecule.yml4
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/prepare.yml4
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/tests/test_default.py2
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/molecule.yml4
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/prepare.yml6
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/tests/test_default.py2
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/molecule.yml12
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/prepare.yml10
-rw-r--r--ansible_collections/community/mongodb/roles/mongodb_install/tasks/main.yml26
12 files changed, 72 insertions, 22 deletions
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/files/lock_mongodb_packages.sh b/ansible_collections/community/mongodb/roles/mongodb_install/files/lock_mongodb_packages.sh
index 0c3e8e6f5..bbfff55c8 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/files/lock_mongodb_packages.sh
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/files/lock_mongodb_packages.sh
@@ -8,13 +8,19 @@ HOLD="$1";
PACKAGE_NAME="mongodb-org*"
if [[ "$HOLD" == "HOLD" ]]; then
- if command -v yum &> /dev/null; then
+ if command -v dnf &> /dev/null; then
+ dnf install "dnf-command(versionlock)"
+ dnf versionlock "$PACKAGE_NAME" && touch /root/mongo_version_lock.success;
+ elif command -v yum &> /dev/null; then
yum versionlock "$PACKAGE_NAME" && touch /root/mongo_version_lock.success;
elif command -v apt-mark &> /dev/null; then
apt-mark hold "$PACKAGE_NAME" && touch /root/mongo_version_lock.success;
fi;
elif [[ "$HOLD" == "NOHOLD" ]]; then
- if command -v yum &> /dev/null; then
+ if command -v dnf &> /dev/null; then
+ dnf install "dnf-command(versionlock)"
+ dnf versionlock delete "$PACKAGE_NAME" || true && rm -rf /root/mongo_version_lock.success;
+ elif command -v yum &> /dev/null; then
yum versionlock delete "$PACKAGE_NAME" || true && rm -rf /root/mongo_version_lock.success;
elif command -v apt-mark &> /dev/null; then
apt-mark unhold "$PACKAGE_NAME" && rm -rf /root/mongo_version_lock.success;
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/molecule.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/molecule.yml
index 5258056e7..aab979c46 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/molecule.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/molecule.yml
@@ -11,8 +11,8 @@ lint:
platforms:
- name: almalinux_8
image: almalinux:8
- - name: ubuntu_18
- image: ubuntu:18.04
+ - name: ubuntu_22_04
+ image: ubuntu:22.04
privileged: yes
command: "/sbin/init"
- name: ubuntu_22
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/prepare.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/prepare.yml
new file mode 100644
index 000000000..1eec53a5c
--- /dev/null
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/default/prepare.yml
@@ -0,0 +1,10 @@
+---
+- name: Prepare
+ hosts: all
+ become: yes
+
+ tasks:
+
+ - name: Install openssl
+ package:
+ name: "openssl" \ No newline at end of file
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/molecule.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/molecule.yml
index 4266ee65b..2767eee61 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/molecule.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/molecule.yml
@@ -13,8 +13,8 @@ platforms:
image: almalinux:8
- name: fedora
image: fedora:37
- - name: ubuntu_18
- image: ubuntu:18.04
+ - name: ubuntu_22_04
+ image: ubuntu:22.04
- name: ubuntu_22
image: ubuntu:22.04
- name: debian_bullseye
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/prepare.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/prepare.yml
index 8a94ca7eb..bcc16f3f1 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/prepare.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/prepare.yml
@@ -10,3 +10,7 @@
name: yum-plugin-versionlock
state: present
when: ansible_facts.os_family == "RedHat"
+
+ - name: Install openssl
+ package:
+ name: "openssl" \ No newline at end of file
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/tests/test_default.py b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/tests/test_default.py
index 381a5823a..72893a0aa 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/tests/test_default.py
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_hold_packages/tests/test_default.py
@@ -17,8 +17,6 @@ def test_mongodb_packages_not_installed(host):
assert p.is_installed
p = host.package("mongodb-org-server")
assert p.is_installed
- p = host.package("mongodb-mongosh")
- assert p.is_installed
p = host.package("mongodb-org-mongos")
assert p.is_installed
p = host.package("mongodb-org-tools")
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/molecule.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/molecule.yml
index 4266ee65b..2767eee61 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/molecule.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/molecule.yml
@@ -13,8 +13,8 @@ platforms:
image: almalinux:8
- name: fedora
image: fedora:37
- - name: ubuntu_18
- image: ubuntu:18.04
+ - name: ubuntu_22_04
+ image: ubuntu:22.04
- name: ubuntu_22
image: ubuntu:22.04
- name: debian_bullseye
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/prepare.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/prepare.yml
index 325651e03..bcc16f3f1 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/prepare.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/prepare.yml
@@ -9,4 +9,8 @@
yum:
name: yum-plugin-versionlock
state: present
- when: ansible_facts.os_family == "RedHat" \ No newline at end of file
+ when: ansible_facts.os_family == "RedHat"
+
+ - name: Install openssl
+ package:
+ name: "openssl" \ No newline at end of file
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/tests/test_default.py b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/tests/test_default.py
index cd1fc5f79..2fc340c43 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/tests/test_default.py
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/mongodb_nohold_packages/tests/test_default.py
@@ -17,8 +17,6 @@ def test_mongodb_packages_installed(host):
assert p.is_installed
p = host.package("mongodb-org-server")
assert p.is_installed
- p = host.package("mongodb-mongosh")
- assert p.is_installed
p = host.package("mongodb-org-mongos")
assert p.is_installed
p = host.package("mongodb-org-tools")
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/molecule.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/molecule.yml
index 3fdeb9123..6ee9a3814 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/molecule.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/molecule.yml
@@ -9,14 +9,14 @@ lint:
config-data:
line-length: disable
platforms:
- #- name: almalinux_8
- # image: almalinux:8 yum seems broken for wildcard/version install for AL8
+ - name: almalinux_8
+ image: almalinux:8
#- name: fedora
# image: fedora:37 ditto
- - name: centos7
- image: centos:7 # Just here while the above two are broken
- - name: ubuntu_18
- image: ubuntu:18.04
+ #- name: centos7
+ # image: centos:7 # Just here while the above two are broken
+ - name: ubuntu_22_04
+ image: ubuntu:22.04
- name: ubuntu_22
image: ubuntu:22.04
- name: debian_bullseye
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/prepare.yml b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/prepare.yml
new file mode 100644
index 000000000..1eec53a5c
--- /dev/null
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/molecule/specific_mongodb_version/prepare.yml
@@ -0,0 +1,10 @@
+---
+- name: Prepare
+ hosts: all
+ become: yes
+
+ tasks:
+
+ - name: Install openssl
+ package:
+ name: "openssl" \ No newline at end of file
diff --git a/ansible_collections/community/mongodb/roles/mongodb_install/tasks/main.yml b/ansible_collections/community/mongodb/roles/mongodb_install/tasks/main.yml
index d43174fd3..02b71f82d 100644
--- a/ansible_collections/community/mongodb/roles/mongodb_install/tasks/main.yml
+++ b/ansible_collections/community/mongodb/roles/mongodb_install/tasks/main.yml
@@ -1,8 +1,23 @@
---
+- 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
+
# tasks file for mongodb_install
- name: Install MongoDB Packages
package:
- name: mongodb-org
+ name:
+ - "mongodb-org"
+ - "mongodb-org-server"
+ - "{{ mongosh_package }}" # variablized due to tls issue
+ - "mongodb-org-mongos"
+ - "mongodb-org-tools"
state: present
when: specific_mongodb_version is not defined
register: _pkg
@@ -15,7 +30,12 @@
- name: Install MongoDB Packages (Specific version)
package:
- name: "mongodb-org*{{ specific_mongodb_version }}"
+ name:
+ - "mongodb-org-{{ specific_mongodb_version }}"
+ - "mongodb-org-server-{{ specific_mongodb_version }}"
+ - "{{ mongosh_package }}" # variablized due to tls issue
+ - "mongodb-org-mongos-{{ specific_mongodb_version }}"
+ - "mongodb-org-tools-{{ specific_mongodb_version }}"
state: present
when:
- specific_mongodb_version is defined
@@ -37,7 +57,7 @@
name:
- "mongodb-org={{ specific_mongodb_version }}"
- "mongodb-org-server={{ specific_mongodb_version }}"
- - "mongodb-mongosh" # mongosh package uses a new versioning number schema
+ - "{{ mongosh_package }}" # variablized due to tls issue
- "mongodb-org-mongos={{ specific_mongodb_version }}"
- "mongodb-org-tools={{ specific_mongodb_version }}"
state: present