juju4 / ansible-mhn

Modern Honey Network deployment with ansible
BSD 2-Clause "Simplified" License
12 stars 6 forks source link

A quick fix to use mongobd-org/3.4 #1

Closed vincentfack closed 4 years ago

vincentfack commented 6 years ago

Hey, while trying to install MHN via your pretty great ansible role, i reached an error with mongo.

Configuration : Debian 9.4

MHN requires mongodb/3.4 but you try to install 3.6. In mongodb.yml, i added some lines in order to fix this, but i think there could be a proper and better solution :

- block:                                                                                                                                                                    
     - name: get_url | Download libssl 1.0.0                                                                                                                                 
       get_url:                                                                                                                                                              
           url: "http://ftp.fr.debian.org/debian/pool/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb"                                                                  
           dest: "{{ MHN_HOME }}/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb"                                                                                                      
     - name: apt | install libssl 1.0.0                                                                                                                                      
       apt:                                                                                                                                                                  
           deb: "{{ MHN_HOME }}/libssl1.0.0_1.0.1t-1+deb8u8_amd64.deb"                                                                                                       
     - name: Apt | Add Mongodb repository key                                                                                                                                
       apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0C49F3730359A14518585931BC711F9BA15703C6                                                                          
     - name: Debian | Add Mongodb repository                                                                                                                                 
       apt_repository: repo='deb http://repo.mongodb.org/apt/{{ ansible_distribution|lower }} jessie/mongodb-org/3.4 main' state=present                                     
       when: ansible_distribution == 'Debian'                                                                                                                                
     - name: Ubuntu | Add Mongodb repository                                                                                                                                 
       apt_repository: repo='deb http://repo.mongodb.org/apt/{{ ansible_distribution|lower }} {{ ansible_distribution_release }}/mongodb-org/3.6 multiverse' state=present   
       when: ansible_distribution == 'Ubuntu' and ansible_distribution_release != 'bionic'                                                                                   
     - block:                                                                                                                                                                
         - name: ensure systemd config directory exists                                                                                                                      
           file: dest=/usr/lib/systemd/system state=directory mode=0755                                                                                                      
         - name: configure systemd config file (not included)                                                                                                                
 ## FIXME! FAILED! => {"changed": true, "failed": true, "msg": "Destination /lib/systemd/system not writable"}                                                               
 #         template: src=mongodb.service.j2 dest=/lib/systemd/system/mongod.service mode=0644                                                                                
           template: src=mongodb.service.j2 dest=/usr/lib/systemd/system/mongod.service mode=0644                                                                            
       when: ansible_service_mgr == 'systemd'                                                                                                                                
 ## http://askubuntu.com/questions/757384/can-i-use-14-04-mongodb-packages-with-16-04                                                                                        
 #    - name: unmask mongodb from systemctl                                                                                                                                  
 #      command: "systemctl unmask mongodb"                                                                                                                                  
   when: ansible_os_family == 'Debian'

As you can see i added some line:

I'm sorry but i don't have much time right now to do a pull request. I wanted you to have the information about my problem and how i fixed it. Regards

juju4 commented 6 years ago

can you detail exact error with mongodb 3.6? unless good reason, I try to stay with most recent version of dependencies and it will help me adding a test to ensure error is identified directly in travis or early testing.

Thanks

vincentfack commented 6 years ago

This was the error message: The 'cursor' option is required, except for aggregate with the explain argument I'll try to reproduce the error.

juju4 commented 6 years ago

libssl part seems https://jira.mongodb.org/browse/SERVER-35277. so debian only and I'm not testing this platform.

if you can find where you got the message and if can check it with a command, I can add a serverspec test

Else reverted to mongodb 3.4. but nok for bionic which only has 3.6 and 3.4 community is not available.

Still suggesting to open an issue upstream even no announced EOL for 3.4 currently (https://www.mongodb.com/support-policy)

juju4 commented 4 years ago

If this is still an issue, please comment and reopen.