I am trying to override juste one setting (server_names_hash_bucket_size
) in the default main template.
Comments in the file state "# Defaults are the values found in a fresh NGINX installation." so I thought enabling nginx_config_main_template_enable
and just overriding the right subkey would do the trick as it would keep the others values.
This didn't work, so I commented out my modification about the custom setting and tried to apply the role with only nginx_config_main_template_enable
set to true
but it fails as well.
Using the role with nginx_config_main_template_enable
set to true
fails with default role values.
Steps to reproduce the behavior:
- name: NGINX
hosts: nginx
debugger: on_failed
become: true
pre_tasks:
- name: Enabling nginx_config_main_template
set_fact:
nginx_config_main_template_enable: true
roles:
- role: nginxinc.nginx
- role: nginxinc.nginx-config
TASK [nginxinc.nginx-config : Dynamically generate NGINX main configuration file] ***********************************************************************************************************
task path: /home/xxx/ansible/yyy/roles/nginxinc.nginx-config/tasks/config/template-config.yml:37
fatal: [nginx_0]: FAILED! => {
"changed": false,
"msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'dest'"
}
I don't have any more info on which 'dict object' it fails on, as the task Dynamically generate NGINX main configuration file
has fallback default values for the dest file (/etc/nginx/nginx.conf
) and thus shouldn't fail.
Comments say "# Defaults are the values found in a fresh NGINX installation." so it should create a standard nginx.conf
file with default values.
ansible 2.9.17
2.11.2
Debian Buster
Found the bug, and as is tradition, found a few other bugs while at it. One of them being that the # Defaults are the values found in a fresh NGINX installation
comment no longer holds true. I'm hoping to have a PR ready asap. The defaults statement might still not be entirely true after the fix, but it should be closer than what it is now 😄
Perfect, keeping an eye on this then : )
Hello, the PR seems to fix the issue indeed (just had to make sure to update the user to www-data as it's the default www user on Debian and the nginx user didn't exist on my system). Thanks for the quick fix : )