778dba94a4
Known kernel modules are: - dm-multipath (for multipathd) - ip_vs (for keepalived) - iscsi_tcp (for ironic-conductor) - openvswitch (for openvswitch-vswitchd) Change-Id: I1841ec30cde142c8019830ad3190847dfe493eb9
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
---
|
|
# 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: Check whether /etc/modules-load.d exists
|
|
stat:
|
|
path: /etc/modules-load.d
|
|
register: modules_load_stat
|
|
|
|
- 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:
|
|
dest: "/etc/modules-load.d/{{ item.name }}.conf"
|
|
src: module-load.conf.j2
|
|
loop: "{{ modules }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when:
|
|
- modules_load_stat.stat.exists
|
|
- (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:
|
|
- modules_load_stat.stat.exists
|
|
- (item.state | default('present')) == 'absent'
|
|
|
|
- name: "Persist modules via /etc/modules"
|
|
become: true
|
|
lineinfile:
|
|
dest: /etc/modules
|
|
line: "{{ item.name }} {{ item.params | default('') }}"
|
|
state: "{{ item.state | default('present') }}"
|
|
loop: "{{ modules }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when: not modules_load_stat.stat.exists
|