-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenable-mpio-linux.yaml
135 lines (114 loc) · 4.73 KB
/
enable-mpio-linux.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
- hosts: "{{ cloud_initiator }}"
become: true
gather_facts: yes
vars:
ansible_python_interpreter: auto
tasks:
- name: Remove 51-ec2-hvm-devices udev rules if Amazon Linux 2
file:
path: /etc/udev/rules.d/51-ec2-hvm-devices.rules
state: absent
when:
- ansible_distribution_file_variety == 'Amazon'
- ansible_distribution_major_version == '2'
- name: Create 99-pure-storage udev rules
shell:
cmd: |
cat > /lib/udev/rules.d/99-pure-storage.rules <<EOF
# Recommended settings for Pure Storage FlashArray.cat
# Use noop scheduler for high-performance solid-state storage
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/scheduler}="noop"
# Reduce CPU overhead due to entropy collection
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/add_random}="0"
# Spread CPU load by redirecting completions to originating CPU
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/rq_affinity}="2"
# Set the HBA timeout to 60 seconds
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{device/timeout}="60"
EOF
- name: Reload new udev rules and trigger
shell:
cmd: udevadm control --reload-rules && udevadm trigger
- name: Install multipath tools when Ubuntu
apt: name=multipath-tools update_cache=yes state=latest force_apt_get=yes
register: multipathtools
when: ansible_distribution_file_variety == 'Debian'
- name: Install multipath tools if when Amazon Linux 2
yum:
name: device-mapper-multipath
state: latest
register: device_mapper_multipath
when:
- ansible_distribution_file_variety == 'Amazon'
- ansible_distribution_major_version == '2'
- debug:
var: device_mapper_multipath
- name: Install multipath tools on SUSE
zypper:
name: multipath-tools
state: latest
register: multipathtools
when: ansible_distribution_file_variety == 'SUSE'
- name: multipathtools
debug:
var: multipathtools
- name: Enable default multipath configuration file and start the multipath daemon when Amazon Linux 2
shell:
cmd: mpathconf --enable --with_multipathd y
when:
- ansible_distribution_file_variety == 'Amazon'
- ansible_distribution_major_version == '2'
- name: create/edit multipath.conf
shell:
cmd: |
cat > /etc/multipath.conf <<EOF
defaults {
polling_interval 10
}
devices {
device {
vendor "PURE"
product "FlashArray"
path_grouping_policy "group_by_prio"
path_checker "tur"
fast_io_fail_tmo 10
dev_loss_tmo 60
no_path_retry 0
hardware_handler "1 alua"
prio "alua"
failback "immediate"
}
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^(td|ha)d[a-z]"
devnode "^nxb*"
devnode "^nvme*"
}
EOF
- name: restart multipathd service
service:
name: multipathd
state: restarted
when: (ansible_distribution_file_variety == 'Debian') or
(ansible_distribution_file_variety == 'Amazon' and ansible_distribution_major_version == '2')
- name: start multipath daemon
shell:
cmd: modprobe dm-multipath
when: ansible_distribution_file_variety == 'SUSE'
- name: start multipathd service
service:
name: multipathd
state: started
when: ansible_distribution_file_variety == 'SUSE'
- name: multipath -v3
shell:
cmd: multipath -v2
when: ansible_distribution_file_variety == 'SUSE'
- name: register multipath -ll output
shell:
cmd: multipath -ll
register: multipathll
- name: print multipath -ll output
debug:
var: multipathll