I have tried to search this a lot but, I am not able to find any proper solution.
I want to install MongoDB 4.2 on 3 machines using Ansible but I don't know how to specify the version.
My OS is Ubuntu Server 20.04
Below yml file is causing version error
---
# tasks file for mongoDB setup
- hosts: ec2
become: true
tasks:
- name: Install aptitude using apt
apt:
name: aptitude
state: latest
update_cache: yes
- name: install mongoDB
apt:
name: mongodb=4.2
state: present
update_cache: yes
- name: Ensure mongodb is running and and enabled to start automatically on reboots
systemd:
name: mongodb
enabled: yes
state: started
Here is the error
TASK [install mongoDB] ********************************************************* fatal: [13.232.181.230]: FAILED! => {"cache_update_time": 1620583763, "cache_updated": true, "changed": false, "msg": "'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'mongodb=4.2'' failed: E: Version '4.2' for 'mongodb' was not found\n", "rc": 100, "stderr": "E: Version '4.2' for 'mongodb' was not found\n", "stderr_lines": ["E: Version '4.2' for 'mongodb' was not found"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}
What is the proper way to install version specific MongoDB on remote machines.
apt?