From 1f2d78b356acd13ab6ad10cf6d1ecbdf7b4daacb Mon Sep 17 00:00:00 2001 From: Dusan Matejka Date: Wed, 30 Oct 2019 16:38:04 +0100 Subject: [PATCH] unify mongodb installation for both xenial and bionic in integration tests --- .../targets/setup_mongodb/defaults/main.yml | 9 +---- .../targets/setup_mongodb/tasks/main.yml | 37 ++++--------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/test/integration/targets/setup_mongodb/defaults/main.yml b/test/integration/targets/setup_mongodb/defaults/main.yml index 55acd964e88..a319bbf505d 100644 --- a/test/integration/targets/setup_mongodb/defaults/main.yml +++ b/test/integration/targets/setup_mongodb/defaults/main.yml @@ -1,14 +1,9 @@ mongodb_version: "4.0" -apt_xenial: - keyserver: "keyserver.ubuntu.com" - keyserver_id: "2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5" - repo: "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu {{ansible_distribution_release}}/mongodb-org/{{mongodb_version}} multiverse" - -apt_bionic: +apt: keyserver: "keyserver.ubuntu.com" keyserver_id: "9DA31620334BD75D9DCB49F368818C72E52529D4" - repo: "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu {{ansible_distribution_release}}/mongodb-org/{{mongodb_version}} multiverse" + repo: "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu {{ansible_distribution_release}}/mongodb-org/{{mongodb_version}} multiverse" mongodb_packages: mongod: mongodb-org-server diff --git a/test/integration/targets/setup_mongodb/tasks/main.yml b/test/integration/targets/setup_mongodb/tasks/main.yml index 4b3817bebdf..3271f472869 100644 --- a/test/integration/targets/setup_mongodb/tasks/main.yml +++ b/test/integration/targets/setup_mongodb/tasks/main.yml @@ -28,42 +28,21 @@ or (ansible_distribution == 'CentOS' and ansible_distribution_version == '7') # Ubuntu -- name: Import MongoDB public GPG Key xenial +- name: Import MongoDB public GPG Key apt_key: - keyserver: "{{ apt_xenial.keyserver }}" - id: "{{ apt_xenial.keyserver_id }}" + keyserver: "{{ apt.keyserver }}" + id: "{{ apt.keyserver_id }}" when: - - ansible_distribution_version == "16.04" - - ansible_distribution == 'Ubuntu' - -- name: Add MongoDB repository into sources list xenial - apt_repository: - repo: "{{ apt_xenial.repo }}" - state: present - when: - - ansible_distribution_version == "16.04" - - ansible_distribution == 'Ubuntu' - -- name: Import MongoDB public GPG Key bionic - apt_key: - keyserver: "{{ apt_bionic.keyserver }}" - id: "{{ apt_bionic.keyserver_id }}" - when: - - ansible_distribution_version == "18.04" + - ansible_distribution_version in ["16.04", "18.04"] - ansible_distribution == 'Ubuntu' -- name: Add MongoDB repository into sources list bionic +- name: Add MongoDB repository into sources list apt_repository: - repo: "{{ apt_bionic.repo }}" + repo: "{{ apt.repo }}" state: present + update_cache: yes when: - - ansible_distribution_version == "18.04" - - ansible_distribution == 'Ubuntu' - -- name: Update apt keys - shell: apt-key update && apt-get update - when: - - mongodb_version != "4.0" + - 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