Git Product home page Git Product logo

Comments (11)

alessfg avatar alessfg commented on August 18, 2024 1

Found the issue. PR coming shortly.

from ansible-role-nginx-config.

ghomem avatar ghomem commented on August 18, 2024 1

I opened a separate issue for the proxy: problem above to not spam this one.

from ansible-role-nginx-config.

ghomem avatar ghomem commented on August 18, 2024

thank you for the quick response, I will follow up the development of this issue.

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

Can you pull from main and check if the latest PR fixed your issue? You might need to do some further tweaks to your template since there's been a few breaking changes since 0.3.3, but hopefully the updated examples in the molecule tests should help you get there.

from ansible-role-nginx-config.

ghomem avatar ghomem commented on August 18, 2024

I can, but I am still testing other configuration situations. I just found a similar situation with gzip:

        gzip:
          enable: true
          buffers:
            number: 32
            size: 4k
          comp_level: 1
          disable:
            - '"msie6"'
          http_version: 1.1
          min_length: 20
          proxied:
            - expired
          types:
            - text/html
          vary: false
fatal: [testing-snap05.snapview.net]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: the inline if-expression on line 27 in 'http/gzip.j2' evaluated to false and no else section was defined."}

Seems to be related to the "proxied" line.

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

That's a weirder error. Can you check which version of Jinja2 you are using? Tests for both the previous and this error pass just fine, and I've seen templates fail for other people when using older versions of Jinja2.

from ansible-role-nginx-config.

ghomem avatar ghomem commented on August 18, 2024

Here is the version:

python3-jinja2 2.10.1-2

I am also having trouble in applying a proxy: section under http_settings. It keeps getting ignored and nothing gets written to nginx.conf.

proxy:  # Optional -- Configure Proxy
  buffer_size: 4k  # Optional
  buffering: true  # Optional boolean
  buffers:  # Optional
    number: 8  # Required
    size: 4k  # Required
  busy_buffers_size: 8k  # Optional
  cache: false  # Optional -- Set to 'false' or specify cache zone

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

You might want to update to Jinja2 2.11.x and see if that addresses any of your errors. Re proxy, there's a typo under defaults/main/template.yml. You should include your proxy details under nginx_config_http_template. I'll create a separate PR to address that asap. When in doubt, the molecule tests are always a good source of truth and should always be fully functional.

from ansible-role-nginx-config.

JKetelaar avatar JKetelaar commented on August 18, 2024

Having the same issue in regards of http/gzip.j2. Tried upgrading to Jinja2==2.11.3, but that hasn't helped either.
This is the config:

---
nginx_config_main_template:
  http_settings:
    gzip:
      enable: true
      buffers:
        number: 32
        size: 16k
      comp_level: 6
      vary: true
      proxied:
      - any
      types:
      - "*"

Error:

    "msg": "AnsibleUndefinedVariable: the inline if-expression on line 27 in 'http/gzip.j2' evaluated to false and no else section was defined.",

from ansible-role-nginx-config.

alessfg avatar alessfg commented on August 18, 2024

Line 27 includes the proxied template. Can you try running the example here https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/default/converge.yml#L62-L76 and seeing if you still run into any issues? That will help determine whether it's an issue with the role or perchance it's still a Jinja2 issue (maybe Jinja2 didn't update correctly?).

from ansible-role-nginx-config.

rhaamo avatar rhaamo commented on August 18, 2024

I did ran into that proxied issue, doing a pip install --upgrade Jinja2 upgraded from 2.10.1 to 3.0.1 and the issue isn't present on next run

from ansible-role-nginx-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.