From 794bd912abc4e8c1016af08ba58367bf60ddfdac Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 26 Jun 2023 10:22:12 +0200 Subject: [PATCH 1/4] Use MongoDB repo, as mondob is no longer included in Ubuntu repos --- handlers/main.yml | 2 +- tasks/main.yml | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index f81c5ed..98db03c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -18,5 +18,5 @@ - name: restart mongodb ansible.builtin.service: - name: mongodb + name: mongod state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 3cad406..ee061ee 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,13 +17,32 @@ deb: /root/graylog-repo.deb state: present +- name: Setup MongoDB repo key + ansible.builtin.apt_key: + url: https://www.mongodb.org/static/pgp/server-6.0.asc + state: present + +- name: Output Ubuntu release name + debug: + var: ansible_distribution_release + +- name: Setup MongoDB repo + ansible.builtin.apt_repository: + repo: "deb https://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/6.0 multiverse" + state: present + - name: Install MongoDB (needed as Graylog settings DB) ansible.builtin.apt: - name: mongodb + name: mongodb-org state: latest update_cache: yes notify: restart mongodb +- name: Enable mongodb server on boot + ansible.builtin.service: + name: mongod + enabled: yes + - name: Install Graylog server ansible.builtin.apt: name: graylog-server From ee1eb147552ac9dda78395e1f503873e4a35295d Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 26 Jun 2023 10:34:22 +0200 Subject: [PATCH 2/4] Also fix CI cleanup task regarding old mongo package naming --- .github/workflows/ansible_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible_test.yml b/.github/workflows/ansible_test.yml index c814fbc..f59d193 100644 --- a/.github/workflows/ansible_test.yml +++ b/.github/workflows/ansible_test.yml @@ -20,7 +20,7 @@ jobs: - name: Clean instance from any mongodb package as this Ansible role will install one itself run: | - sudo apt-get -y purge mongodb mongodb-server mongodb-server-core mongodb-clients mongodb-org + sudo apt-get -y purge mongodb-org mongodb-org-database sudo apt-get -y autoremove - name: Show APT repos From 4bc53c779bbaf8bdb8f5c535f551b5a7f15b8ea2 Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 26 Jun 2023 10:38:31 +0200 Subject: [PATCH 3/4] Remove entire mongo cleanup task from CI steps, seems its no longer needed --- .github/workflows/ansible_test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ansible_test.yml b/.github/workflows/ansible_test.yml index f59d193..99dab0b 100644 --- a/.github/workflows/ansible_test.yml +++ b/.github/workflows/ansible_test.yml @@ -18,11 +18,6 @@ jobs: with: python-version: 3.8 - - name: Clean instance from any mongodb package as this Ansible role will install one itself - run: | - sudo apt-get -y purge mongodb-org mongodb-org-database - sudo apt-get -y autoremove - - name: Show APT repos run: ls /etc/apt/sources.list.d/ From fb589d79ff08005dc704200fd9c739fa2ea7aa41 Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 26 Jun 2023 10:55:04 +0200 Subject: [PATCH 4/4] Also fix mongo naming in specs --- spec/main_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/main_spec.rb b/spec/main_spec.rb index eed2c89..c416071 100644 --- a/spec/main_spec.rb +++ b/spec/main_spec.rb @@ -5,7 +5,7 @@ it { should be_installed } end - describe package('mongodb') do + describe package('mongodb-org') do it { should be_installed } end @@ -18,7 +18,7 @@ it { should be_enabled } end - describe service('mongodb') do + describe service('mongod') do it { should be_running } it { should be_enabled } end