nginx/ansible-role-nginx-config

Not a bug: basic usage question

Closed this issue · 2 comments

Describe the bug

This is not a bug. Just a question on basic usage. New to Ansible and nginx.

To reproduce

Steps to reproduce the behavior:

I want to change default root path (Apache-ism is DocumentRoot) from /usr/share/nginx/html to /var/www/html. I know the config file to change would be /etc/nginx/conf.d/default.conf and the section:

    location / {
        root   /var/www/html;
        index  index.html index.htm;
    }

But I can't seem to get a single change from my playbook. I'm experimenting with another issue I saw here in the github issues. I'm experimenting with this --but it does nothing.

I realize this won't change location / --but it's just a starting point.

This is how I run the playbook: ansible-playbook nginxinc.nginx_config.yml -K

nginxinc.nginx_config.yml:

- hosts: testing
  become: true
  roles:
    - {role: nginxinc.nginx_config}
  vars:
    # nginx_config_debug_output: true
    nginx_config_http_template:
      - template_file: http/default.conf.j2
        conf_file_name: 50_example.com.conf
        conf_file_location: /etc/nginx/conf.d/
        servers:
          - listen:
              - port: 8080
              - 

Expected behavior

Could you show me an example of how to change location / { root /var/www/html; ...

Your environment

  • installed from ansible galaxy
  • ansible 2.9.6+dfsg-1
  • ubuntu Ubuntu 20.04.3 LTS

Additional context

None.

Heya!

Can you have a look at the molecule example here and see if it helps?
https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/default/converge.yml#L647-L651

From what I can see from your logs it looks like you are also running an old version of Ansible. I would suggest updating to the latest release 🙂

If that still doesn't help, I'll try to come up with a better example, but it might take a few days given the holidays.

It's been a while since the last update so I'm going to close this issue for the time being. Feel free to reopen it if you have any further questions!