-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_add_metadataservices.yaml
88 lines (74 loc) · 2.75 KB
/
03_add_metadataservices.yaml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
- hosts: metadataservices
become: yes
tasks:
- name: Check for trusted service networks
lineinfile:
path: /etc/quobyte/metadata.cfg
state: present
line: "rpc.service_networks={{ trusted_service_networks }}"
when: 'trusted_service_networks is defined'
- name: Enable Quobyte metadata service
service:
enabled: yes
state: started
name: "{{ item }}"
with_items:
- quobyte-metadata
- hosts: metadataservices
vars_files:
- vars/ansible-vars
become: yes
tasks:
- set_fact:
device_name_short: "{{ metadatadevices | replace( '/dev/','' ) }}"
- name: Create a xfs filesystem on {{ metadatadevices }}
filesystem:
fstype: xfs
opts: -isize=1024
dev: "/dev/{{ item }}"
with_items: "{{ metadatadevices }}"
- name: Label metadata device with "quobyte-dev"
command:
cmd: xfs_admin -L quobyte-dev /dev/{{ item }}
##creates: /var/lib/quobyte/mnt/inspector-{{ item }}/QUOBYTE_DEV_SETUP
creates: /var/lib/quobyte/mnt/inspector-{{ item }}
with_items: "{{ metadatadevices }}"
- name: Make sure device labels are up to date
command:
cmd: partprobe /dev/{{ item }}
with_items: "{{ metadatadevices }}"
- name: Wait for automounted metadata devices
wait_for:
path: /proc/mounts
search_regex: /var/lib/quobyte/mnt/inspector-{{ item }}
with_items:
- "{{ device_name_short }}"
# https://github.com/ansible/ansible/issues/79683
when: ansible_version.full >= "2.16.1" or ansible_version.full <= "2.13.7"
- name: Wait for device inspector to find any unused devices (workaround for broken ansible)
pause:
seconds: 45
# https://github.com/ansible/ansible/issues/79683
when: ansible_version.full < "2.16.1" and ansible_version.full > "2.13.7"
- name: Run qmkdev to create metadata device
command:
cmd: /usr/bin/qmkdev -t METADATA /var/lib/quobyte/mnt/inspector-{{ item }}
creates: /var/lib/quobyte/mnt/inspector-{{ item }}/QUOBYTE_DEV_SETUP
with_items: "{{ metadatadevices }}"
- hosts: registryservices[0]
vars_files:
- vars/ansible-vars
vars:
metadata_device_count: "{{ metadatadevices | length }}"
become: yes
tasks:
- name: Get Quobyte session
shell:
cmd: qmgmt -u {{ api_service }} user login {{ admin_user }} {{ admin_password }}
- name: Wait for all {{ metadata_device_count }} metadata devices to become available
shell:
cmd: qmgmt -u {{ api_service }} device list METADATA | grep ONLINE | wc -l
register: metadata_device_state
retries: 12
delay: 10
until: metadata_device_state.stdout >= metadata_device_count