Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sol1 Ansible Roles
sol1-influxdb
Commits
780391a4
Commit
780391a4
authored
Jan 20, 2016
by
Ross McDonald
Browse files
More tweaking for the new clustering configuration. Switched to IPs for all cluster settings.
parent
9032b711
Changes
6
Hide whitespace changes
Inline
Side-by-side
tasks/cluster.yml
View file @
780391a4
...
...
@@ -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
tasks/configure.yml
View file @
780391a4
...
...
@@ -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
tasks/main.yml
View file @
780391a4
...
...
@@ -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
...
...
templates/etc/default/influxdb.j2
View file @
780391a4
{% 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 %}
templates/etc/hosts.j2
View file @
780391a4
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'] }}
...
...
templates/influxdb.conf.j2
View file @
780391a4
...
...
@@ -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 }}"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment