Commit 35b8dab7 authored by Ross McDonald's avatar Ross McDonald
Browse files

Added extra flag to control whether InfluxDB should be started on install....

Added extra flag to control whether InfluxDB should be started on install. Templates use 'influxdb' group when joining cluster, so all influxdb instances that need to be clustered must be part of that group (previously it was using all hosts).
parent 35eb943f
......@@ -2,6 +2,8 @@
# Channel of InfluxDB to install (stable, unstable, nightly)
influxdb_install_version: stable
influxdb_start_service: yes
# If multiple servers are specified, whether to create a clustered configuration
# NOTE:
# - Do not attempt to cluster previously-unclustered servers. This can lead to data loss.
......
......@@ -32,4 +32,5 @@
enabled: yes
notify:
- pause
when: influxdb_start_service == True
INFLUXD_OPTS="-hostname {{ ansible_hostname }}{% if influxdb_cluster_servers %} -join {% for host in groups['all']|sort %}{% if hostvars[host]['ansible_hostname'] != ansible_hostname %}{{ hostvars[host]['ansible_hostname'] }}:{{ influxdb_meta_port }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %}"
INFLUXD_OPTS="-hostname {{ ansible_hostname }}{% if influxdb_cluster_servers %} -join {% for host in groups['influxdb']|sort %}{% if hostvars[host]['ansible_hostname'] != ansible_hostname %}{{ hostvars[host]['ansible_hostname'] }}:{{ influxdb_meta_port }}{% if not loop.last %},{% endif %}{% endif %}{% endfor %}{% endif %}"
......@@ -17,7 +17,11 @@ reporting-disabled = {{ influxdb_disable_reporting }}
[meta]
dir = "{{ influxdb_meta_dir }}"
{% if influxdb_cluster_servers %}
hostname = "{{ ansible_hostname }}"
{% else %}
hostname = "localhost"
{% endif %}
bind-address = ":{{ influxdb_meta_port }}"
retention-autocreate = {{ influxdb_meta_retention_autocreate }}
election-timeout = "{{ influxdb_meta_election_timeout }}"
......
......@@ -3,6 +3,11 @@
- defaults/main.yml
- vars/main.yml
tasks:
- name: Add all hosts to influxdb group
add_host:
name: "{{ ansible_hostname }}"
groups: influxdb
- include: tasks/main.yml
handlers:
- include: handlers/main.yml
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment