diff --git a/test/integration/targets/incidental_mongodb_parameter/aliases b/test/integration/targets/incidental_mongodb_parameter/aliases deleted file mode 100644 index 72ed62eb1d1..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/aliases +++ /dev/null @@ -1,9 +0,0 @@ -destructive -shippable/posix/incidental -skip/aix -skip/osx -skip/macos -skip/freebsd -skip/rhel -needs/root -context/target diff --git a/test/integration/targets/incidental_mongodb_parameter/defaults/main.yml b/test/integration/targets/incidental_mongodb_parameter/defaults/main.yml deleted file mode 100644 index aac55526df6..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/defaults/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# defaults file for test_mongodb_user -mongodb_admin_user: test_root -mongodb_admin_password: saE_Rr9!gE6gh#e~R#nZ -mongod_auth: false -kill_signal: SIGTERM -# Should be one of -# --storageEngine wiredTiger --wiredTigerEngineConfigString="cache_size=200M" -# --storageEngine mmapv1 --nojournal -mongod_storage_engine_opts: "--storageEngine wiredTiger --wiredTigerEngineConfigString='cache_size=200M'" -mongodb_user: mongodb -mongodb_user_list: - - { "name": "user1", "password": "password1", "roles": "read", "database": "test" } - - { "name": "user2", "password": "password2", "roles": "readWrite", "database": "test" } - - { "name": "user3", "password": "password3", "roles": "dbAdmin", "database": "test" } - - { "name": "user4", "password": "password4", "roles": "userAdmin", "database": "test" } - - { "name": "user5", "password": "password5", "roles": "clusterAdmin", "database": "admin" } - - { "name": "user6", "password": "password6", "roles": "readAnyDatabase", "database": "admin" } - - { "name": "user7", "password": "password7", "roles": "readWriteAnyDatabase", "database": "admin" } - - { "name": "user8", "password": "password8", "roles": "userAdminAnyDatabase", "database": "admin" } - - { "name": "user9", "password": "password9", "roles": "dbAdminAnyDatabase", "database": "admin" } diff --git a/test/integration/targets/incidental_mongodb_parameter/meta/main.yml b/test/integration/targets/incidental_mongodb_parameter/meta/main.yml deleted file mode 100644 index 10fc3936a3b..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -dependencies: - - incidental_setup_mongodb - - setup_remote_tmp_dir diff --git a/test/integration/targets/incidental_mongodb_parameter/tasks/main.yml b/test/integration/targets/incidental_mongodb_parameter/tasks/main.yml deleted file mode 100644 index a0fda1dc601..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/tasks/main.yml +++ /dev/null @@ -1,143 +0,0 @@ -# test code for the mongodb_parameter module -# (c) 2019, Rhys Campbell - -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# ============================================================ - -- name: Ensure tests home exists - file: - path: "{{ remote_tmp_dir }}/tests" - state: directory - -- include_tasks: mongod_teardown.yml - -- include_tasks: mongod_singlenode.yml - -- name: Set syncdelay to 99 - mongodb_parameter: - login_port: 3001 - param: syncdelay - value: 99 - param_type: int - register: sd_change - -- assert: - that: - - sd_change.before | int == 60 - - sd_change.after | int == 99 - - sd_change.changed == True - -- name: Set syncdelay to 99 (again) - mongodb_parameter: - login_port: 3001 - param: syncdelay - value: 99 - param_type: int - register: sd_change - -- assert: - that: - - sd_change.before | int == 99 - - sd_change.after | int == 99 - - sd_change.changed == False - -- name: Create admin user with module - mongodb_user: - login_port: 3001 - database: admin - name: "{{ mongodb_admin_user }}" - password: "{{ mongodb_admin_password }}" - roles: root - state: present - register: mongodb_admin_user_created - -- assert: - that: - - mongodb_admin_user_created.changed == True - -- name: Kill all mongod processes - command: pkill -{{ kill_signal }} mongod - ignore_errors: true - -- name: Getting pids for mongod - pids: - name: mongod - register: pids_of_mongod - -- name: Wait for all mongod processes to exit - wait_for: - path: "/proc/{{ item }}/status" - state: absent - delay: 3 - with_items: "{{ pids_of_mongod }}" - -- set_fact: - mongod_auth: true - -- include_tasks: mongod_singlenode.yml -# Tests with auth enabled - -- name: Set syncdelay to 59 with auth - mongodb_parameter: - login_port: 3001 - login_user: "{{ mongodb_admin_user }}" - login_password: "{{ mongodb_admin_password }}" - param: syncdelay - value: 59 - param_type: int - register: sd_change - -- assert: - that: - - sd_change.before | int == 60 - - sd_change.after | int == 59 - - sd_change.changed == True - -- name: Set syncdelay to 59 (again) with auth - mongodb_parameter: - login_port: 3001 - login_user: "{{ mongodb_admin_user }}" - login_password: "{{ mongodb_admin_password }}" - param: syncdelay - value: 59 - param_type: int - register: sd_change - -- assert: - that: - - sd_change.before | int == 59 - - sd_change.after | int == 59 - - sd_change.changed == False - -- name: Set authenticationMechanisms to MONGODB-X509 with auth (will fail) - mongodb_parameter: - login_port: 3001 - login_user: "{{ mongodb_admin_user }}" - login_password: "{{ mongodb_admin_password }}" - param: authenticationMechanisms - value: "MONGODB-X509" - param_type: str - register: diag_change - ignore_errors: yes - -- assert: - that: - - '"unable to change parameter" in diag_change.msg' - - diag_change.failed == True - -# Clean up -- include_tasks: mongod_teardown.yml diff --git a/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_singlenode.yml b/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_singlenode.yml deleted file mode 100644 index 291cb1c9804..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_singlenode.yml +++ /dev/null @@ -1,55 +0,0 @@ -- name: Set mongodb_user user for redhat - set_fact: - mongodb_user: "mongod" - when: ansible_os_family == "RedHat" - -- set_fact: - mongodb_nodes: - - 3001 - -- name: Create directories for mongod processes - file: - path: "{{ remote_tmp_dir }}/mongod{{ item }}" - state: directory - owner: "{{ mongodb_user }}" - group: "{{ mongodb_user }}" - mode: 0755 - recurse: yes - with_items: "{{ mongodb_nodes }}" - -- name: Ensure {{ remote_tmp_dir }}/config dir exists - file: - path: "{{ remote_tmp_dir }}/config" - state: directory - owner: "{{ mongodb_user }}" - group: "{{ mongodb_user }}" - mode: 0755 - -- name: Create keyfile - copy: - dest: "{{ remote_tmp_dir }}/my.key" - content: | - fd2CUrbXBJpB4rt74A6F - owner: "{{ mongodb_user }}" - group: "{{ mongodb_user }}" - mode: 0600 - when: mongod_auth == True - -- name: Spawn mongod process without auth - command: mongod --shardsvr --smallfiles {{ mongod_storage_engine_opts }} --dbpath mongod{{ item }} --port {{ item }} --logpath mongod{{ item }}/log.log --fork - args: - chdir: "{{ remote_tmp_dir }}" - with_items: "{{ mongodb_nodes | sort }}" - when: mongod_auth == False - -- name: Spawn mongod process with auth - command: mongod --shardsvr --smallfiles {{ mongod_storage_engine_opts }} --dbpath mongod{{ item }} --port {{ item }} --logpath mongod{{ item }}/log.log --fork --auth --keyFile my.key - args: - chdir: "{{ remote_tmp_dir }}" - with_items: "{{ mongodb_nodes | sort }}" - when: mongod_auth == True - -- name: Wait for mongod to start responding - wait_for: - port: "{{ item }}" - with_items: "{{ mongodb_nodes }}" diff --git a/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_teardown.yml b/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_teardown.yml deleted file mode 100644 index a904a718b22..00000000000 --- a/test/integration/targets/incidental_mongodb_parameter/tasks/mongod_teardown.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: Kill all mongod processes - command: pkill -{{ kill_signal }} mongod - ignore_errors: true - -- name: Getting pids for mongod - pids: - name: mongod - register: pids_of_mongod - -- name: Wait for all mongod processes to exit - wait_for: - path: "/proc/{{ item }}/status" - state: absent - delay: 1 - with_items: "{{ pids_of_mongod }}" - -- name: Remove all mongod folders - file: - path: "{{ remote_tmp_dir }}/{{ item }}" - state: absent - with_items: - - mongod3001 - -- name: Remove all mongod sock files - shell: rm -Rf /tmp/mongodb*.sock diff --git a/test/integration/targets/incidental_setup_mongodb/aliases b/test/integration/targets/incidental_setup_mongodb/aliases deleted file mode 100644 index 136c05e0d02..00000000000 --- a/test/integration/targets/incidental_setup_mongodb/aliases +++ /dev/null @@ -1 +0,0 @@ -hidden diff --git a/test/integration/targets/incidental_setup_mongodb/defaults/main.yml b/test/integration/targets/incidental_setup_mongodb/defaults/main.yml deleted file mode 100644 index b205013c947..00000000000 --- a/test/integration/targets/incidental_setup_mongodb/defaults/main.yml +++ /dev/null @@ -1,46 +0,0 @@ -mongodb_version: "4.0" - -apt: - keyserver: "keyserver.ubuntu.com" - keyserver_id: "9DA31620334BD75D9DCB49F368818C72E52529D4" - repo: "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu {{ansible_distribution_release}}/mongodb-org/{{mongodb_version}} multiverse" - -mongodb_packages: - mongod: mongodb-org-server - mongos: mongodb-org-mongos - mongo: mongodb-org-shell - -yum: - name: mongodb-org - description: "Official MongoDB {{mongodb_version}} yum repo" - baseurl: https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/{{mongodb_version}}/x86_64/ - gpgcheck: 1 - gpgkey: https://www.mongodb.org/static/pgp/server-{{mongodb_version}}.asc - redhat8url: https://repo.mongodb.org/yum/redhat/7/mongodb-org/{{mongodb_version}}/x86_64/ - fedoraurl: https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/{{mongodb_version}}/x86_64/ - -debian_packages_py2: - - python-dev - - python-setuptools - - python-pip - -debian_packages_py36: - - python3.6-dev - - python3-setuptools - - python3-pip - -redhat_packages_py2: - - python-devel - - python-setuptools - - python-pip - -redhat_packages_py3: - - python3-devel - - python3-setuptools - - python3-pip - -# Do not install requests[security] via pip. It will cause test failures. -# See https://github.com/ansible/ansible/pull/66319 -pip_packages: - - psutil - - pymongo diff --git a/test/integration/targets/incidental_setup_mongodb/handlers/main.yml b/test/integration/targets/incidental_setup_mongodb/handlers/main.yml deleted file mode 100644 index 1b73525e9c9..00000000000 --- a/test/integration/targets/incidental_setup_mongodb/handlers/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -- name: Remove debian_packages_py2 - apt: - name: "{{ debian_packages_py2 }}" - state: absent - -- name: Remove debian_packages_py36 - apt: - name: "{{ debian_packages_py36 }}" - state: absent - -- name: Remove redhat_packages_py2 - yum: - name: "{{ redhat_packages_py36 }}" - state: absent - -- name: Remove redhat_packages_py36 - yum: - name: "{{ redhat_packages_py36 }}" - state: absent - -- name: remove mongodb pip packages - pip: - name: "{{ pip_packages }}" - state: absent diff --git a/test/integration/targets/incidental_setup_mongodb/tasks/main.yml b/test/integration/targets/incidental_setup_mongodb/tasks/main.yml deleted file mode 100644 index 3bd090ca63c..00000000000 --- a/test/integration/targets/incidental_setup_mongodb/tasks/main.yml +++ /dev/null @@ -1,168 +0,0 @@ -# (c) 2019, Rhys Campbell - -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# ============================================================ - -# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ -# Support for Ubuntu 14.04 has been removed from MongoDB 4.0.10+, 3.6.13+, and 3.4.21+. -# CentOS6 has python version issues -# Ubuntu 20.04 does not yet have the required packages -- meta: end_play - when: (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04') - or (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '20.04') - or (ansible_os_family == "RedHat" and ansible_distribution_major_version == '6') - or ansible_os_family == "Suse" - or ansible_distribution == 'Fedora' - or (ansible_facts['distribution'] == "CentOS") - -# Ubuntu -- name: Import MongoDB public GPG Key - apt_key: - keyserver: "{{ apt.keyserver }}" - id: "{{ apt.keyserver_id }}" - when: - - ansible_distribution_version in ["16.04", "18.04"] - - ansible_distribution == 'Ubuntu' - -- name: Add MongoDB repository into sources list - apt_repository: - repo: "{{ apt.repo }}" - state: present - update_cache: yes - when: - - ansible_distribution_version in ["16.04", "18.04"] - - ansible_distribution == 'Ubuntu' - -# Need to handle various platforms here. Package name will not always be the same -- name: Ensure mongod package is installed - apt: - name: "{{ mongodb_packages.mongod }}" - state: present - force: yes - when: - - ansible_distribution == 'Ubuntu' - -- name: Ensure mongos package is installed - apt: - name: "{{ mongodb_packages.mongos }}" - state: present - force: yes - when: - - ansible_distribution == 'Ubuntu' - -- name: Ensure mongo client is installed - apt: - name: "{{ mongodb_packages.mongo }}" - state: present - force: yes - when: - - ansible_distribution == 'Ubuntu' -# EOF Ubuntu - -# Redhat -- name: Add MongopDB repo - yum_repository: - name: "{{ yum.name }}" - description: "{{ yum.description }}" - baseurl: "{{ yum.baseurl }}" - gpgcheck: "{{ yum.gpgcheck }}" - gpgkey: "{{ yum.gpgkey }}" - when: - - ansible_os_family == "RedHat" - - ansible_distribution_version.split('.')[0]|int <= 7 - - not ansible_distribution == "Fedora" - - -- name: RedHat 8 repo not yet available so use 7 url - yum_repository: - name: "{{ yum.name }}" - description: "{{ yum.description }}" - baseurl: "{{ yum.redhat8url }}" - gpgcheck: "{{ yum.gpgcheck }}" - gpgkey: "{{ yum.gpgkey }}" - when: - - ansible_os_family == "RedHat" - - ansible_distribution_version.split('.')[0]|int == 8 - - not ansible_distribution == "Fedora" - -- name: Another url for Fedora based systems - yum_repository: - name: "{{ yum.name }}" - description: "{{ yum.description }}" - baseurl: "{{ yum.fedoraurl }}" - gpgcheck: "{{ yum.gpgcheck }}" - gpgkey: "{{ yum.gpgkey }}" - when: - - ansible_distribution == "Fedora" - -- name: Ensure mongod package is installed - yum: - name: "{{ mongodb_packages.mongod }}" - state: present - when: ansible_os_family == "RedHat" - -- name: Ensure mongos package is installed - yum: - name: "{{ mongodb_packages.mongos }}" - state: present - when: ansible_os_family == "RedHat" - -- name: Ensure mongo client is installed - yum: - name: "{{ mongodb_packages.mongo }}" - state: present - when: ansible_os_family == "RedHat" -# EOF Redhat - -- name: Install debian_packages - apt: - name: "{{ debian_packages_py2 }}" - when: - - ansible_os_family == "Debian" - - ansible_distribution_version == "16.04" - notify: Remove debian_packages_py2 - -- name: Install debian_packages - apt: - name: "{{ debian_packages_py36 }}" - when: - - ansible_os_family == "Debian" - - ansible_distribution_version == "18.04" - notify: Remove debian_packages_py36 - -- name: Install redhat_packages_py2 - yum: - name: "{{ redhat_packages_py2 }}" - when: - - ansible_os_family == "RedHat" - - ansible_distribution_version|float < 8 - - not (ansible_os_family == "RedHat" and ansible_distribution_version|float < 8) - notify: Remove redhat_packages_py2 - -- name: Install redhat_packages_py3 - yum: - name: "{{ redhat_packages_py3 }}" - when: - - ansible_os_family == "RedHat" - - ansible_distribution_version|float >= 8 - notify: Remove redhat_packages_py3 - -- name: Install pip packages - pip: - name: "{{ pip_packages }}" - state: present - notify: remove mongodb pip packages