Universidad-de-Costa-Rica / role-mailman3

Ansible role to install Mailman3 Suite alongside Nginx, Postfix, Postgres and Cerbot on Debian 10
MIT License
4 stars 1 forks source link

Error installing LE certificate due to nginx configuration backup #3

Closed m0baer closed 3 years ago

m0baer commented 3 years ago

Hi there,

thank you for the mailman3 role. I tried to use it and the install failed at my first attempts while certbot tried to restart nginx. Reason is that a backup of the mailman3.conf is in /etc/nginx/sites-enabled/ and nginx is trying to also load the backup resulting in a dulpicate upstream configuration: (Error report is shortened)

TASK [mailman3 : install certificate] ************************************************************************************************************************ fatal: [mailman]: FAILED! => [...] "The nginx plugin is not working; there may be problems with your existing configuration.", "The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\\n\\nnginx: [emerg] duplicate upstream \"mailman\" in /etc/nginx/sites-enabled/mailman3.conf.15192.2021-01-22@22:15:23~:4\\nnginx: configuration file /etc/nginx/nginx.conf test failed\\n')"], "stdout": "", "stdout_lines": []}

When changing tasks/certbot.yml and tasks/nginx.yml to not use backups (backup: false instead of true on every occurence) the mailman install works like a charm on a system rolled back from a snapshot.

Hope that helps, Jochen

valarauco commented 3 years ago

Hi Jochen,

Commit f4e3b8a1fd84f646ef38e46e1b639bef3afd3212 is supposed to fix that issue, can you confirm you are running it with this patch?

m0baer commented 3 years ago

Hi Manuel,

you're right. I see the template in the repo. However looking at the server after the playbook run I see the default nginx.conf of the deb there. I had to set mailman3_nginx_main_template: true to use the jinja2 templated nginx.conf and the playbook runs as expected. Maybe the file backups should be skipped when mailman3_nginx_main_template is not true ?

Now I am also stuck at issue #2

Thank you, Jochen

valarauco commented 3 years ago

Yes, we are working on it.

Thank you for helping us testing!