blob: 8a1bedccbb171e56c0337ac77b030d33219cdc78 (
plain)
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
|
---
# Allow to get a clean way to load and persist kernel modules
- name: Run tasks only for specific kolla_action
when:
- kolla_action != "config"
block:
- name: Load modules
become: true
modprobe:
name: "{{ item.name }}"
params: "{{ item.params | default(omit) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ modules }}"
loop_control:
label: "{{ item.name }}"
- name: Persist modules via modules-load.d
become: true
template:
src: module-load.conf.j2
dest: "/etc/modules-load.d/{{ item.name }}.conf"
mode: "0644"
loop: "{{ modules }}"
loop_control:
label: "{{ item.name }}"
when:
- (item.state | default('present')) == 'present'
- name: Drop module persistence
become: true
file:
path: "/etc/modules-load.d/{{ item.name }}.conf"
state: absent
loop: "{{ modules }}"
loop_control:
label: "{{ item.name }}"
when:
- (item.state | default('present')) == 'absent'
|