GithubHelp home page GithubHelp logo

Idempotent issues... about ansible-nginx HOT 8 CLOSED

debops avatar debops commented on July 28, 2024
Idempotent issues...

from ansible-nginx.

Comments (8)

drybjed avatar drybjed commented on July 28, 2024

I think cleaning up old nginx config files could be added. It would work like this:

  • set a delete: True key in server configuration
  • rerun the playbook, so that Ansible deletes symlinks to the configs, configs themselves and reloads nginx
  • remove the server configuration from inventory

This will allow you do do something like:

nginx_servers: [ '{{ nginx_old_server }}', '{{ nginx_new_server }}' ]

nginx_old_server:
  name: [ 'example.com' ]
  enabled: False
  delete: True

nginx_new_server:
  name: [ 'example.com' ]
  enabled: True

I think this should remain idempotent as well. I will look into it in the near future.

from ansible-nginx.

 avatar commented on July 28, 2024

Makes sense to me. Prior to this we were also using Jinja2 templating for our webserver.conf files and then just manually creating the symlink. Your approach works really well but I didn't see a way to trigger options based on a variable. Basically the ability to build something like:

  location ~ ^/.*/_mapping {
    proxy_pass http://127.0.0.1:9200;
    proxy_read_timeout 90;
    {% if kibana_password_protect_all %}
    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd;
    {% endif %}
  }

from ansible-nginx.

drybjed avatar drybjed commented on July 28, 2024
nginx_server_kibana:
  location:
    '~ ^/.*/_mapping': |
      proxy_pass http://127.0.0.1:9200;
      proxy_read_timeout 90;
      {% if kibana_password_protect_all %}
      auth_basic "Restricted";
      auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd;
      {% endif %}

Yes, the text block config style is that simple :-) Here's another example: https://github.com/debops/ansible-phpipam/blob/master/vars/main.yml#L44-L50

from ansible-nginx.

drybjed avatar drybjed commented on July 28, 2024

@zahlenofzahlen BTW, we have debops.redis, debops.elasticsearch, I haven't decided yet between fluentd and LogStash, what do you use? Either way, is your Kibana role open source? :-)

from ansible-nginx.

 avatar commented on July 28, 2024

I'm using debops.nginx and debops.elasticsearch and just modifying https://github.com/geerlingguy/ansible-role-kibana to work with with it. I put in a few things to specify Kibana version, etc. But that's pretty much it. Unfortunately I don't have any of it open source.

from ansible-nginx.

drybjed avatar drybjed commented on July 28, 2024

@zahlenofzahlen Interesting to hear about debops.elasticsearch, can you describe your setup? This role was tested extensively locally, but haven't been tried in a real cluster, we are interested in the results.

from ansible-nginx.

 avatar commented on July 28, 2024

Well at this point we are developing small reproducible environments so it's not a true cluster. It's just elasticsearch, kibana, and ElasticHQ. If we get the go ahead I might be able to release a debops playbook for graphite/grafana. I haven't started building that yet. It would have elasticsearch as a dependency. We haven't done any real testing with Elasticsearch and honestly if it's not 100% right that's fine as we can afford some manually tweaking after the fact.

from ansible-nginx.

drybjed avatar drybjed commented on July 28, 2024

@zahlenofzahlen Your issues have been fixed by dd113d7 and cd5eb63, cheers. :-)

from ansible-nginx.

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.