Hi,

I'm deploying MongoDB to a number of servers using the script below.  
Servers are Ubuntu 18.0.4.   I have an issue where the installation fails 
to create a mongo folder in /var/run/ and thus can't start the service (No 
place to put the PID file)
I modified the Ansible script to create the /var/run/mongodb folder with 
the correct permissions, so this installs MongoDB and starts it, but after 
a reboot the MongoDB folder is removed (because var/run is not persistent)

Is this an issue with how I'm installing mongo via Ansible?  



- hosts: mongo
  become: true
  gather_facts: true
  vars:
    ################# Mongo #################
    mongodb_db_path: '/data/db'
    mongodb_log_path: '/data/log'

  tasks:

################################################################
# Install/Setup Mongo
################################################################
   - name: Add MongoDB public GPG key to the apt repo
     apt_key:
       url: '{{ mongo_key_url }}'
       state: present

   - name: Add MongoDB Repo
     apt_repository:
       repo: '{{ mongo_repo_url }}'
       state: present

   - name: Run the equivalent of "apt-get update" as a separate step
     apt:
       update_cache: yes

   - name: Install MongoDB
     apt:
       name: 'mongodb-org'
       state: latest



## Fix
   - name: Create diretory for pid
     file:
       path="/var/run/mongodb"
       owner=mongodb
       group=mongodb
       state=directory


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e80f511f-2c26-40cf-a130-9c6d50d809d0%40googlegroups.com.

Reply via email to