Installing mongodb using ansible

0 votes
I'm trying to install MongoDB using ansible. How will my playbook look?
Mar 15, 2019 in Ansible by Neel
3,744 views

1 answer to this question.

0 votes

Your mongodb role should look something like this:

- name: MongoDB - Import public key
  apt_key:
    keyserver: hkp://keyserver.ubuntu.com:80
    id: EA312927

- name: MongoDB - Add repository
  apt_repository:
    filename: '/etc/apt/sources.list.d/mongodb-org-3.2.list'
    repo: 'deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse'
    state: present
    update_cache: yes

- name: MongoDB - Install MongoDB
  apt:
    name: mongodb-org
    state: present
    update_cache: yes

- name: MongoDB - Running state
  service:
    name: mongod
    state: started


Hope this helps!!

To know more about Mongodb, go for Mongodb training online without fail.

Thanks!

answered Mar 15, 2019 by Purva

Related Questions In Ansible

0 votes
1 answer

style.css not getting executed while installing lamp stack using ansible

Hey @Kishore make sure, your folder directory ...READ MORE

answered Feb 9, 2019 in Ansible by Monish
566 views
0 votes
1 answer

Installing nodejs using ansible

Your role should look something like this: - ...READ MORE

answered Mar 15, 2019 in Ansible by Hari
5,516 views
0 votes
1 answer

How to install mongodb on centos 7 using ansible

Hi@Shashi, I think for MongoDB you need to ...READ MORE

answered Sep 16, 2020 in Ansible by MD
• 95,440 points
3,086 views
0 votes
1 answer

I am having issues installing basic packages using ansible

Hi@akhtar, Every application has some dependencies. Then only ...READ MORE

answered Nov 24, 2020 in Ansible by MD
• 95,440 points
464 views
0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,890 points
659 views
+1 vote
3 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP