Hi Vladimir,

If I install Mongo manually  apt-get install mongodb-org if install fine 
and the /var/run/mongodb folder is created every reboot
it's only when I install via Ansible then it doesn't.

e.g. a manual install also creates a mongodb file in /etc/init.d  the 
Ansible install does not

I have worked round the problem with your option 3.
I have created a file in /urs/lib/tmpfiles.d called mongo.conf contents of:

d /var/run/mongodb 0755 mongodb mongodb -

This creates the mongodb directory every reboot.

It does seem weird that the installs differs via Ansible vs manual 

Regards,
Steve

On Monday, 16 September 2019 10:11:12 UTC+1, Vladimir Botka wrote:
>
> Hi, 
>
> On Mon, 16 Sep 2019 00:59:18 -0700 (PDT) 
> Stephen Thorpe <[email protected] <javascript:>> wrote: 
>
> > 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) ... 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?   
>
> No. It's not Ansible issue at all. MongoDB doesn't care about the 
> directory. 
> There are more options: 
>
> 1) Put "pidfile" to persistent location 
>    https://docs.mongodb.com/manual/reference/configuration-options/ 
>
> 2) Fix the service to create the directory. See hints 
>    
> https://github.com/mongodb/mongo/commit/50ca596ace0b1390482408f1b19ffb1f9170cab6
>  
>
> 3) Create the directory on your own at startup. 
>
> Cheers, 
>
>         -vlado 
>

-- 
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/afb62232-6dc2-4da6-8528-78a554685d75%40googlegroups.com.

Reply via email to