cluster.yml 1.42 KB
Newer Older
1
---
2

3
- name: Set clustered configuration
James Martin's avatar
James Martin committed
4
5
6
7
8
9
10
11
  template:
    src: etc/default/influxdb.j2
    dest: /etc/default/influxdb
    force: yes
    backup: yes
    owner: root
    group: root
    mode: 0644
12
13
  register: influxdb_cluster_set

14
15
16
17
18
19
- name: Stop InfluxDB
  service: 
    name: influxdb
    state: stopped
  when: influxdb_cluster_set.changed or influxdb_purge_peer_data

20
21
22
23
24
- name: Purge existing peer data
  file: 
    path: "{{ item }}"
    state: absent
  with_items:
25
26
27
28
    - "{{ influxdb_meta_dir }}"
    - "{{ influxdb_data_dir }}"
    - "{{ influxdb_data_wal_dir }}"
  when: influxdb_purge_peer_data
29
  
30
31
32
33
34
# - name: Start InfluxDB
#   service: 
#     name: influxdb
#     state: started
#   when: influxdb_cluster_set.changed or influxdb_purge_peer_data
35

36
37
38
39
# - name: Pause for a moment
#   pause:
#     seconds: 3
#   when: influxdb_cluster_set.changed or influxdb_purge_peer_data
40
  
41
42
43
# - name: Collect cluster status
#   command: "{{ influxdb_binary_path }}/influx -execute 'show servers'"
#   register: influxdb_show_servers_output
44

45
46
47
48
49
50
# - name: Assert clustering status (local/vagrant)
#   assert:
#     that:
#       - "influxdb_show_servers_output.stdout.find(item)"
#   with_items: groups['all']
#   when: is_vagrant
51

52
53
54
55
56
57
# - 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"
58