Skip to content

Instantly share code, notes, and snippets.

@mohclips
Created February 9, 2017 22:53
Show Gist options
  • Save mohclips/84513f79cf85a01542a34d5ddf08df37 to your computer and use it in GitHub Desktop.
Save mohclips/84513f79cf85a01542a34d5ddf08df37 to your computer and use it in GitHub Desktop.
fun lineinfile to update the beats configs with the elastic search hosts
- name: "Update configs"
lineinfile:
dest: "/etc/{{ item }}/{{ item }}.yml"
regexp: '^ hosts:'
line: ' hosts: [{% set comma = joiner(",") %}{% for es in elastic_search_hosts %}{{ comma() }}"{{ es }}"{% endfor %} ]'
with_items:
- filebeat
- packetbeat
- metricbeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment