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