geerlingguy / ansible-role-elasticsearch

Ansible Role - Elasticsearch
https://galaxy.ansible.com/geerlingguy/elasticsearch/
MIT License
185 stars 209 forks source link

Use templates not lineinfile #21

Closed leifmadsen closed 8 years ago

leifmadsen commented 8 years ago

This resolves issue #20

Ahmed commented 8 years ago

I was like wtf, why he is not using a template?

leifmadsen commented 8 years ago

@Ahmed well, it makes sense when the configuration file could change / add more values etc, so the lineinfile option makes sense since it keeps things a little more intact / version agnostic.

I personally have just found writing the regex and and such to be a little more effort than it's worth, especially when the template is relatively short.

geerlingguy commented 8 years ago

I was like wtf, why he is not using a template?

I often use lineinfile if I need to change < 5 variables in a template, for a few reasons:

  1. I can use the system packaged default template (which varies by OS and version somewhat, usually)
  2. I don't have to maintain a monolithic template that is now used across all OSes and versions
  3. There's a lot less Ansible configuration involved (see the diff here).

That said, I do switch to including and copying a template when the situation warrants it... and it may here. It looks like it at least works across all the main supported OSes with the current ES version.