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
b270c56c
Commit
b270c56c
authored
Dec 02, 2015
by
Ross McDonald
Browse files
Improved cluster mechanics and a little more process control.
parent
3ed9a75a
Changes
4
Hide whitespace changes
Inline
Side-by-side
defaults/main.yml
View file @
b270c56c
...
...
@@ -2,13 +2,14 @@
# Channel of InfluxDB to install (stable, unstable, nightly)
influxdb_install_version
:
stable
# If yes, service will be started. Will not be started if set to no.
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.
# - This will overwrite your /etc/default/influxdb file (though it makes a backup)
influxdb_cluster_servers
:
no
influxdb_cluster_servers
:
yes
# When clustering is enabled, whether or not to overwrite the /etc/hosts file with raw
# IPs (may be useful if no DNS resolution).
influxdb_overwrite_hosts_file
:
yes
...
...
tasks/cluster.yml
View file @
b270c56c
...
...
@@ -10,7 +10,7 @@
mode
:
0644
when
:
influxdb_overwrite_hosts_file
-
name
:
C
luster
servers
-
name
:
Set c
luster
ed configuration
template
:
src
:
etc/default/influxdb.j2
dest
:
/etc/default/influxdb
...
...
@@ -19,8 +19,33 @@
owner
:
root
group
:
root
mode
:
0644
notify
:
-
purge metaid
-
purge raftdb
-
purge peers
-
restart influxdb
register
:
influxdb_cluster_set
-
name
:
Purge existing peer data
file
:
path
:
"
{{
item
}}"
state
:
absent
with_items
:
-
"
{{
influxdb_meta_dir
}}/id"
-
"
{{
influxdb_meta_dir
}}/raft.db"
-
"
{{
influxdb_meta_dir
}}/peers.json"
when
:
influxdb_cluster_set.changed or influxdb_purge_peer_data
-
name
:
Restart InfluxDB
service
:
name
:
influxdb
state
:
restarted
when
:
influxdb_cluster_set.changed or influxdb_purge_peer_data
-
name
:
Pause for a moment
pause
:
seconds
:
5
when
:
influxdb_cluster_set.changed or influxdb_purge_peer_data
-
name
:
Collect cluster status
command
:
influx -execute 'show servers'
register
:
influxdb_show_servers_output
-
name
:
Display output
debug
:
var
:
influxdb_show_servers_output
\ No newline at end of file
tasks/configure.yml
View file @
b270c56c
...
...
@@ -30,7 +30,21 @@
name
:
influxdb
state
:
started
enabled
:
yes
notify
:
-
pause
register
:
influxdb_started
when
:
influxdb_start_service == True
-
name
:
Pause to ensure InfluxDB service is up
pause
:
seconds
:
3
when
:
influxdb_started.changed and influxdb_start_service == True
-
name
:
Collect service status
command
:
service influxdb status
register
:
influxdb_service_status
when
:
influxdb_start_service == True
-
name
:
Assert status of InfluxDB service
assert
:
that
:
-
"
influxdb_service_status.rc
==
0"
when
:
influxdb_start_service == True
\ No newline at end of file
vars/main.yml
View file @
b270c56c
...
...
@@ -2,3 +2,6 @@
# Whether or not the playbook is run locally (changes clustering logic slightly)
is_vagrant
:
no
# Whether or not to purge peer data on each run (useful for cluster testing)
influxdb_purge_peer_data
:
yes
\ No newline at end of file
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