Graylog2 / graylog-ansible-role

Ansible role which installs and configures Graylog
Apache License 2.0
212 stars 127 forks source link

Ubuntu 20.04 and mongodb-org version #164

Closed grzybniak closed 3 years ago

grzybniak commented 3 years ago

If you want to install mongodb-org version this part of code is blocking this option: https://github.com/Graylog2/graylog-ansible-role/blob/master/tasks/mongodb-Debian.yml#L15

Maybe there should be an option to keep variables instead of static values

btw, thx for very good role!

malcyon commented 3 years ago

That's a good point. I was just trying to make it work on Ubuntu 20.04. Maybe I tried to make it too smart. Maybe just letting people override the variable would be better.

On a fresh Ubuntu 20.04 VM, mongodb works and mongodb-org doesn't work.

vagrant@instance:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mongodb-org
vagrant@instance:~$ sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5 libsnappy1v5
  libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb-clients mongodb-server mongodb-server-core
The following NEW packages will be installed:
  libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-program-options1.71.0 libgoogle-perftools4 libpcrecpp0v5 libsnappy1v5
  libtcmalloc-minimal4 libyaml-cpp0.6 mongo-tools mongodb mongodb-clients mongodb-server mongodb-server-core
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.8 MB of archives.
After this operation, 234 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

But I suppose if someone had another repo hooked up mongodb-org might potentially work and the code wouldn't be correct.

grzybniak commented 3 years ago

I added those variables to playbook:

    graylog_install_mongodb: True
    graylog_mongodb_version: 4.4
    graylog_mongodb_package_name: mongodb-org
    graylog_mongodb_service_name: mongod    

The role added a repo and I could install mongodb-repo:

root@graylog1 /etc/apt # cat sources.list.d/repo_mongodb_org_apt_ubuntu.list 
deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse
root@graylog1 /home/marcin # apt-cache policy mongodb-org
mongodb-org:
  Installed: 4.4.3
  Candidate: 4.4.3
  Version table:
 *** 4.4.3 500
        500 http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse amd64 Packages
        100 /var/lib/dpkg/status
     4.4.2 500
        500 http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse amd64 Packages
     4.4.1 500
        500 http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse amd64 Packages
     4.4.0 500
        500 http://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4/multiverse amd64 Packages
grzybniak commented 3 years ago

Default package for ubuntu mongodb: 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5 ( v3.6.9 ) is ok for graylog. I wanted to run it on 4.2 or 4.4

malcyon commented 3 years ago

In retrospect, it seems like it was a bad idea for me to provide a user-configurable variable and then override it with a static value in the code. What's weird is that, without that code, it fails for me if I set graylog_mongodb_version to 4.2, but it works fine if I set it to 4.4. There must be some renaming of things going on between versions. If anyone runs into this problem, they can just change those variables themselves.

@grzybniak Can you try it again with v3.3.1 of the role?

grzybniak commented 3 years ago

I could install whole stack without problems. Thank you!