nginxinc / ansible-role-nginx

Ansible role for installing NGINX
https://galaxy.ansible.com/nginxinc/nginx
Apache License 2.0
637 stars 344 forks source link

Implement ngx_http_sub_module #213

Closed shokinn closed 4 years ago

shokinn commented 4 years ago

Is your feature request related to a problem? Please describe. I run a reverse proxy whrere this filter is mandatory.

Describe the solution you'd like Fully implement the ngx_http_sub_module with all functionalities.

Describe alternatives you've considered There aren't any alternative apart from writing an own configuration file and copy it directly to the host.

I would be happy to file a PR if you are Ok.

Regards,

alessfg commented 4 years ago

Feel free to file a PR @shokinn 😄

For what is worth, and I know this hasn't been all that properly documented, you can now use the custom_options parameter at different levels of your template configuration to implement/configure any directive you wish.

shokinn commented 4 years ago

Ah ok, didn't know that.

But I think it's still a good idea to implement configuration options nativly.

Something different, I'm running into an issue by running the molecule test --all.

molecule test --all
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/module/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/template_alpine/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/unit/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/module_centos/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/unit_alpine/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/template/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/module_alpine/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/unit_centos/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/stable_push/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/default/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/stable_push_alpine/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/template_centos/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/default_alpine/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/default_centos/molecule.yml.
Validation completed successfully.
--> Validating schema /home/phg/workspace/ansible-role-nginx/molecule/stable_push_centos/molecule.yml.
Validation completed successfully.
--> Test matrix

├── default
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── default_alpine
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── default_centos
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── module
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── module_alpine
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── module_centos
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── stable_push
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── stable_push_alpine
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── stable_push_centos
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── template
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── template_alpine
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── template_centos
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── unit
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
├── unit_alpine
│   ├── lint
│   ├── dependency
│   ├── cleanup
│   ├── destroy
│   ├── syntax
│   ├── create
│   ├── prepare
│   ├── converge
│   ├── idempotence
│   ├── side_effect
│   ├── verify
│   ├── cleanup
│   └── destroy
└── unit_centos
    ├── lint
    ├── dependency
    ├── cleanup
    ├── destroy
    ├── syntax
    ├── create
    ├── prepare
    ├── converge
    ├── idempotence
    ├── side_effect
    ├── verify
    ├── cleanup
    └── destroy

--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /home/phg/workspace/ansible-role-nginx/...
Lint completed successfully.
--> Executing Flake8 on files found in /home/phg/workspace/ansible-role-nginx/molecule/default/../common/test_default/...
Lint completed successfully.
--> Executing Ansible Lint on /home/phg/workspace/ansible-role-nginx/molecule/common/playbook_default.yml...
[WARNING]: Skipping plugin
(/home/phg/.local/pipx/venvs/molecule/lib/python3.8/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: No module named 'molecule'

Lint completed successfully.
--> Scenario: 'default'
--> Action: 'dependency'
Skipping, missing the requirements file.
--> Scenario: 'default'
--> Action: 'cleanup'
Skipping, cleanup playbook not configured.
--> Scenario: 'default'
--> Action: 'destroy'
--> Sanity checks: 'docker'

    PLAY [Destroy] *****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
[WARNING]: Skipping plugin
(/home/phg/.local/pipx/venvs/molecule/lib/python3.8/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: No module named 'molecule'

    fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ lookup('file', molecule_file) | molecule_from_yaml }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no filter named 'molecule_from_yaml'. String: {{ lookup('file', molecule_file) | molecule_from_yaml }}"}

    PLAY RECAP *********************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

ERROR:
An error occurred during the test sequence action: 'destroy'. Cleaning up.
--> Scenario: 'default'
--> Action: 'cleanup'
Skipping, cleanup playbook not configured.
--> Scenario: 'default'
--> Action: 'destroy'

    PLAY [Destroy] *****************************************************************

    TASK [Destroy molecule instance(s)] ********************************************
[WARNING]: Skipping plugin
(/home/phg/.local/pipx/venvs/molecule/lib/python3.8/site-
packages/molecule/provisioner/ansible/plugins/filters/molecule_core.py) as it
seems to be invalid: No module named 'molecule'

    fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while templating '{{ lookup('file', molecule_file) | molecule_from_yaml }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: no filter named 'molecule_from_yaml'. String: {{ lookup('file', molecule_file) | molecule_from_yaml }}"}

    PLAY RECAP *********************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

ERROR:

Any Ideas?

Btw. I'm running a Windows 10 Preview slow ring with a wsl2 with an arch linux.

alessfg commented 4 years ago

But I think it's still a good idea to implement configuration options nativly.

I do not disagree 😄 PRs are welcome!

Re: molecule. I have no clue, but I've found this thread https://github.com/ansible/molecule/issues/1851#issue-422884858. I would suggest giving some of those solutions a try?

shokinn commented 4 years ago

Re: molecule. I have no clue, but I've found this thread ansible/molecule#1851 (comment). I would suggest giving some of those solutions a try?

Thanks! Fixed it. For whatever reason it's only working, when I install ansible and molecule[docker] as system packages via pip.

shokinn commented 4 years ago

PR is merged: https://github.com/nginxinc/ansible-role-nginx/pull/216