ansible-role-nginx icon indicating copy to clipboard operation
ansible-role-nginx copied to clipboard

Allow users to add a dynamic module during a build from source

Open alessfg opened this issue 1 year ago • 5 comments

Discussed in https://github.com/nginxinc/ansible-role-nginx/discussions/638

Originally posted by tibz7 August 3, 2023 Is there a way to use this role and install geoip2 for the opensource version? Something like using the source and passing compilation flags? Otherwise the only option i thought of was to not use this role and write my own tasks to compile it with the needed module.

alessfg avatar Aug 07 '23 11:08 alessfg

Hi alessfg,

try

nginx_install_from: source
nginx_static_modules: [http_ssl_module,http_geoip2_module]

olwe0002 avatar Aug 27 '23 04:08 olwe0002

That parameter is used for NGINX modules following the --with pattern listed here http://nginx.org/en/docs/configure.html and given the open source geoip2 module is considered an external module, you would have to use --add-module=... or --add-dynamic-module=... instead.

alessfg avatar Aug 28 '23 17:08 alessfg

Hello, any progress on this?

tibz7 avatar Nov 20 '23 09:11 tibz7

Not really, no. Building from source is not recommended and as such building from source options are what we consider a "community" developed feature. This does not mean that it will not get worked on, but any other active issue and/or PR is affecting any other feature of the role is prioritized.

PRs are always welcome!

alessfg avatar Nov 20 '23 18:11 alessfg

I'm not sure if Ansible (which is a configuration management tool?) is the best solution for a build automation. Nginx offers pkg-oss "framework": http://hg.nginx.org/pkg-oss . With it you can build nginx and any module with, like, 3 commands:

hg clone http://hg.nginx.org/pkg-oss
cd pkg-oss/$os_flavor
make base module-geoip2

You can swap hg for git if you have proper git module installed. It doesn't get much easier than that. And if you need a module which is not in the list of provided "examples" - you can use build_module.sh which will write a stub makefile for you. And instead of just putting some binaries somewhere (good luck accounting those) you'll have proper OS specific packages which are way easier to maintain. Is it really worth maintaining 10 different ways of doing the same in a worse way?..

And you can ask for help with pkg-oss in a community slack, IRC channel or mailing lists (if you are like really, really old. Like my age maybe :)

oxpa avatar Nov 20 '23 18:11 oxpa