On 9/16/19 9:59 AM, Stephen Thorpe wrote:
> 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?  

Hello Stephen,

I would expect that the package installed via APT takes care of the PID file 
and /run subdirectory management.

Regards
         Racke

> 
> 
> 
> - 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] 
> <mailto:[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
> <https://groups.google.com/d/msgid/ansible-project/e80f511f-2c26-40cf-a130-9c6d50d809d0%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/2a479342-5c44-306f-8061-326087e1cd3d%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to