Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a way to install custom modules #13

Closed
StudioMaX opened this issue Aug 20, 2020 · 2 comments
Closed

Need a way to install custom modules #13

StudioMaX opened this issue Aug 20, 2020 · 2 comments
Labels
wontfix This will not be worked on

Comments

@StudioMaX
Copy link
Contributor

To install nginx I use my own RPM repository (for CentOS 7/8). This is necessary because standard repositories (CentOS and the official nginx RPM repository) lack many necessary modules, for example https://github.com/leev/ngx_http_geoip2_module, https://github.com/google/ngx_brotli and a few else. Therefore, instead of compiling the nginx right on the production server, I build it locally and distribute it through my RPM repository, which was installed via pre_tasks before executing this role.

Is your feature request related to a problem? Please describe.
Now we can install only those modules for which separate tasks have been created: njs, perl, waf (Nginx Plus), geoip (RHEL < 8), image_filter, rtmp (Nginx Plus), xslt.
But we are not able to install any other module, since there is no task to install the list of extra packages.

Describe the solution you'd like
All tasks for all operating systems must be changes to install any extra package BEFORE starting/restarting/reloading nginx. This must be some sort of

- name: "(Install: Linux) Install additional Package"
  package:
    name: "{{ nginx_additional_packages }}"
    state: "{{ nginx_state }}"
  when: nginx_install_from == "os_repository" # ???
  notify: "(Handler: All OSs) Reload NGINX"

Additional context

  • These custom modules cannot be installed via pre_tasks, because they will require nginx package, which wasn' installed at this moment.
  • These custom modules cannot be installed via tasks or post_tasks, because nginx.conf will contain loading of these modules via load_module "modules/ngx_http_geoip2_module.so";, so nginx won't be restarted correctly when this role will notify about this.

There is a second problem here, since neither the CentOS repositories nor the official nginx repos contain any other modules. From the ansible side, this will look exactly the same as if you set nginx_install_from == "os_repository", which means "do not install official nginx repository, just install package nginx with the system package manager".
There will be no problems here as long as there is package nginx in the system or my own repositories. But what if we distribute our package with a different name, for example nginx-custom, so that when updating the packages via yum update, we do not accidentally install package nginx from some other repositories, which may have a version higher than in my own repository.
Therefore, we need some way to specify the name of the nginx package, and, accordingly, all the modules for it (like package nginx-custom and modules nginx-custom-module-geoip2).

@alessfg
Copy link
Collaborator

alessfg commented Aug 21, 2020

A few thoughts:

  1. Anything related to installing modules should probably live in https://github.com/nginxinc/ansible-role-nginx instead of here. That being said, adding a list variable to the template for load_modules would make sense within this role.
  2. The modules that are currently supported reflect the modules that are officially supported in some way or shape by NGINX (you can check them here https://docs.nginx.com/nginx/admin-guide/dynamic-modules/dynamic-modules/). There're no plans at the moment to support installing custom or third party modules. That being said, a few modules have been added since modules were last tweaked in this role (including an in house supported brotli module). I'll work on implementing them as soon as I can.
  3. Following from the previous point, there're also no plans at the moment to support installing custom NGINX packages. Allowing to install NGINX from each distros package repository was the one exception (and is not recommended under most circumstances).

@alessfg alessfg added the wontfix This will not be worked on label Sep 2, 2020
@alessfg
Copy link
Collaborator

alessfg commented Sep 2, 2020

I'm marking this issue as wontfix since there's no plans in the near future to support custom modules, but I've created a new issue to track the implementation of pending official supported modules in the ansible-role-nginx repo nginxinc/ansible-role-nginx#314

@alessfg alessfg added this to To do in NGINX Configuration via automation Sep 2, 2020
@alessfg alessfg closed this as completed Sep 2, 2020
NGINX Configuration automation moved this from To do to Done Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
No open projects
Development

No branches or pull requests

2 participants