Define fastcgi vars for roles\nginx\defaults\main.yml

I’ve got error 502, and it seems it’s due to small fastcgi buffers. Tested it by direct file edit on virtual machine, no more 502.

How to define the
that are used in nginx.conf.j2?

I tried defining them in group_vars\all\main.yml but it didn’t affect /etc/nginx/nginx.conf in the virtual machine, not even after vagrant provision.

Can you share exactly what you did?

I added these two lines to group_vars\all\main.yml
nginx_fastcgi_buffers: 8 16k
nginx_fastcgi_buffer_size: 16k

And ran vagrant provision on host, and sudo service nginx restart in vbox.

One potential for how this could happen relates to Ansible’s variable precedence. Suppose you were to have these same variables defined in group_vars/development/. Such (unmodified) variables would override your modified variables in group_vars/all/. (Any particular group in group_vars will take precedence over the all group.)

You could search your Trellis files for other conflicting definitions of these vars, potentially even in temp files. Of course, the values in roles/nginx/defaults/main.yml shouldn’t be conflicting because they have the lowest priority.

When working out variable precedence, it is often helpful to temporarily insert a debug task into the relevant task file or context, just to ensure you know what Ansible is using for variable values. Example:

- debug:
    msg: |
      nginx_fastcgi_buffers is `{{ nginx_fastcgi_buffers }}`
      nginx_fastcgi_buffer_size is `{{ nginx_fastcgi_buffer_size }}`

Didn’t know about debug, thanks for the tip. Could it be due to empty line, between last default line in main.yml and my two lines?
It seems removing the empty line and doing vagrant provision did the trick.