Commit 780391a4 authored by Ross McDonald's avatar Ross McDonald
Browse files

More tweaking for the new clustering configuration. Switched to IPs for all cluster settings.

parent 9032b711
......@@ -27,32 +27,32 @@
- "{{ influxdb_meta_dir }}/peers.json"
when: influxdb_cluster_set.changed or influxdb_purge_peer_data
- name: Start InfluxDB
service:
name: influxdb
state: started
when: influxdb_cluster_set.changed or influxdb_purge_peer_data
# - name: Start InfluxDB
# service:
# name: influxdb
# state: started
# when: influxdb_cluster_set.changed or influxdb_purge_peer_data
- name: Pause for a moment
pause:
seconds: 3
when: influxdb_cluster_set.changed or influxdb_purge_peer_data
# - name: Pause for a moment
# pause:
# seconds: 3
# when: influxdb_cluster_set.changed or influxdb_purge_peer_data
- name: Collect cluster status
command: "{{ influxdb_binary_path }}/influx -execute 'show servers'"
register: influxdb_show_servers_output
# - name: Collect cluster status
# command: "{{ influxdb_binary_path }}/influx -execute 'show servers'"
# register: influxdb_show_servers_output
- name: Assert clustering status (local/vagrant)
assert:
that:
- "influxdb_show_servers_output.stdout.find(item)"
with_items: groups['all']
when: is_vagrant
# - name: Assert clustering status (local/vagrant)
# assert:
# that:
# - "influxdb_show_servers_output.stdout.find(item)"
# with_items: groups['all']
# when: is_vagrant
- name: Assert clustering status (non-local)
assert:
that:
- "influxdb_show_servers_output.stdout.find(item)"
with_items: groups['influxdb']|default([])
when: "'influxdb' in groups and is_vagrant == False"
# - name: Assert clustering status (non-local)
# assert:
# that:
# - "influxdb_show_servers_output.stdout.find(item)"
# with_items: groups['influxdb']|default([])
# when: "'influxdb' in groups and is_vagrant == False"
\ No newline at end of file
......@@ -4,9 +4,6 @@
path: "{{ influxdb_configuration_dir }}"
state: directory
- debug:
var: hostvars
- name: Set templatized InfluxDB configuration
template:
src: influxdb.conf.j2
......@@ -17,28 +14,3 @@
group: influxdb
mode: 0744
when: influxdb_template_configuration
- name: Start the InfluxDB service
service:
name: influxdb
state: restarted
enabled: yes
register: influxdb_started
when: influxdb_start_service
- name: Pause to ensure InfluxDB service is up
pause:
seconds: 3
when: influxdb_started.changed and influxdb_start_service
- name: Collect service status
command: service influxdb status
register: influxdb_service_status
when: influxdb_start_service
ignore_errors: yes
- name: Assert status of InfluxDB service
assert:
that:
- "influxdb_service_status.rc == 0"
when: influxdb_start_service
......@@ -9,6 +9,31 @@
tags: [influxdb, cluster]
when: influxdb_cluster_servers and influxdb_start_service
- name: Start the InfluxDB service
service:
name: influxdb
state: restarted
enabled: yes
register: influxdb_started
when: influxdb_start_service
- name: Pause to ensure InfluxDB service is up
pause:
seconds: 3
when: influxdb_started.changed and influxdb_start_service
- name: Collect service status
command: service influxdb status
register: influxdb_service_status
when: influxdb_start_service
ignore_errors: yes
- name: Assert status of InfluxDB service
assert:
that:
- "influxdb_service_status.rc == 0"
when: influxdb_start_service
- include: demo.yml
tags: [influxdb, demo]
when: influxdb_load_sample_data and influxdb_http_auth_enabled == "false" and influxdb_start_service
......
{% if is_vagrant and influxdb_cluster_servers %}
VAGRANT=true
{% if groups['all'][0] != ansible_hostname %}
INFLUXD_OPTS="-join {% for host in groups['all'] if hostvars[host]['ansible_hostname'] != ansible_hostname %}{% if loop.index0 <= 1 %}{{ hostvars[host]['ansible_hostname'] }}:{{ influxdb_meta_http_port }}{% if not loop.index > 1 %},{% endif %}{% endif %}{% endfor %}"
INFLUXD_OPTS="-join {% for host in groups['all'] if hostvars[host]['ansible_hostname'] != ansible_hostname %}{% if loop.index0 <= 1 %}{{ hostvars[host]['ansible_all_ipv4_addresses']|last }}:{{ influxdb_meta_http_port }}{% if not loop.index > 1 %},{% endif %}{% endif %}{% endfor %}"
{% endif %}
{% else %}
VAGRANT=false
{% if groups['influxdb'][0] != ansible_hostname %}
INFLUXD_OPTS="-join {% for host in groups['influxdb'] if hostvars[host]['ansible_hostname'] != ansible_hostname %}{% if loop.index0 <= 1 %}{{ hostvars[host]['ansible_hostname'] }}:{{ influxdb_meta_http_port }}{% if not loop.index > 1 %},{% endif %}{% endif %}{% endfor %}"
{% if hostvars[groups['influxdb'][0]]['ansible_hostname'] != ansible_hostname %}
INFLUXD_OPTS="-join {% for host in groups['influxdb'] if hostvars[host]['ansible_hostname'] != ansible_hostname %}{% if loop.index0 <= 1 %}{{ ansible_all_ipv4_addresses|last }}:{{ influxdb_meta_http_port }}{% if not loop.index > 1 %},{% endif %}{% endif %}{% endfor %}"
{% endif %}
{% endif %}
127.0.0.1 {{ ansible_fqdn }} localhost localhost.localdomain localhost4 localhost4.localdomain4
{{ ansible_all_ipv4_addresses|last }} {{ ansible_hostname }}
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
{{ ansible_all_ipv4_addresses|last }} {{ ansible_hostname }}
{% for host in groups['all'] %}
{% if host != "localhost" and hostvars[host]['ansible_hostname'] != ansible_hostname %}
{{ hostvars[host]['ansible_all_ipv4_addresses'] | last }} {{ hostvars[host]['ansible_hostname'] }}
......
......@@ -8,9 +8,10 @@
# Change this option to true to disable reporting.
reporting-disabled = {{ influxdb_disable_reporting }}
dir = ""
hostname = "{{ ansible_hostname }}"
bind-address = ""
# Commenting these out, as they cause issues in the current iteration
#dir = ""
#hostname = "{{ ansible_all_ipv4_addresses|last }}"
#bind-address = ""
###
### [meta]
......@@ -105,7 +106,6 @@ bind-address = ""
###
### Controls the enforcement of retention policies for evicting old data.
###
[retention]
enabled = {{ influxdb_retention_enabled }}
check-interval = "{{ influxdb_retention_check_interval }}"
......
Markdown is supported
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