-
Notifications
You must be signed in to change notification settings - Fork 2
/
upgrade-whole-cluster-pre.yml
42 lines (37 loc) · 1.8 KB
/
upgrade-whole-cluster-pre.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
# This playbook optionally prints some useful information about the state of MooseFS prior to running upgrades.
# It is intended to be used before performing a whole cluster upgrade.
# WIP
- name: Run checks before an upgrade
hosts: moosefs_master
serial: 1
become: true
vars_files:
- "vars/moosefs-settings.yml"
- "vars/upgrade-settings.yml"
pre_tasks:
- name: Check the state of the chunk matrix
command: mfscli -SIC -H {{ moosefs_master_host }} -p -s ' '
register: moosefs_chunks_status
check_mode: false
changed_when: false
when: inventory_hostname == ansible_play_hosts[0]
- name: Check the state of the chunkservers
command: mfscli -SCS -H {{ moosefs_master_host }} -p -s ' '
register: moosefs_chunkserver_status
check_mode: false
changed_when: false
when: inventory_hostname == ansible_play_hosts[0]
- name: Determine the current state of the chunk matrix
set_fact:
moosefs_chunks_missing: "{{ moosefs_chunks_status.stdout_lines | select('search', 'chunkclass missing:') | select('search', ': 0') | length == 0 }}"
moosefs_chunks_endangered: "{{ moosefs_chunks_status.stdout_lines | select('search', 'chunkclass endangered:') | select('search', ': 0') | length == 0 }}"
moosefs_chunks_undergoal: "{{ moosefs_chunks_status.stdout_lines | select('search', 'chunkclass undergoal:') | select('search', ': 0') | length == 0 }}"
when: inventory_hostname == ansible_play_hosts[0]
- name: Print the current state of the chunk matrix
debug:
msg:
- "Chunks missing? {{ moosefs_chunks_missing }}"
- "Chunks endangered? {{ moosefs_chunks_endangered }}"
- "Chunks undergoal? {{ moosefs_chunks_undergoal }}"
when: inventory_hostname == ansible_play_hosts[0]