-
Notifications
You must be signed in to change notification settings - Fork 21
/
ais_datafs_mkfs.yml
50 lines (47 loc) · 1.78 KB
/
ais_datafs_mkfs.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
43
44
45
46
47
48
49
50
#
# Perform mkfs of AIS target filesystems. Not something you want to do lightly, so intentionally
# a little awkward to run - we don't include default values for ais_hosts and ais_devices,
# requiring that they be passed on the cmdline (defaulting to k8s-cluster, for example,
# could be bad!)
#
# After mkfs we will add the filesystems to /etc/fstab and mount them.
#
# This playbook will prompt for confirmation when the play is run interactively.
#
# Example usage:
#
# ansible-playbook -i hosts.ini ais_datafs_mkfs.yml \
# -e '{"ais_hosts": ["cpu01", "cpu02"], \
# "ais_devices": ["sda", "sdb", "sdc", "sdd", "sde", "sdf", "sdg", "sdh", "sdi", "sdj"]}' \
# --become
#
# In initial establishment of a set of hosts you might use an inventory group to target hosts,
# such as ... -e '{"ais_hosts": ["cpu-worker-node"] ...
#
# You can list ais_devices in vars/ais_datafs.yml, but shouldn't list ais_hosts there.
#
---
- name: Confirm and proceed with filesystem creation
hosts: "{{ ais_hosts }}"
# TODO: perform gather facts only if mkfs_confirmation is true
gather_facts: true
become: true
vars_files:
- "vars/ais_datafs.yml"
vars_prompt:
- name: mkfs_confirmation
prompt: "Do you want to format drives with XFS and mount it on ais/<device>. Type 'yes' to confirm."
default: "no"
private: no
pre_tasks:
- name: check if ais_devices is present
fail:
msg: "var 'ais_devices' not found! Please add the variable in `ais-k8s/playbooks/host-config/vars/ais_datafs.yml` or pass it as an env variable"
when: ais_devices is undefined
roles:
- role: ais_datafs
when: mkfs_confirmation | bool
vars:
ais_fs_umount_purge: true
ais_fs_losedata: "danger_danger"
ais_fs_mount: true