Load known, standard kernel modules from the host, not within containers
Known kernel modules are: - dm-multipath (for multipathd) - ip_vs (for keepalived) - iscsi_tcp (for ironic-conductor) - openvswitch (for openvswitch-vswitchd) Change-Id: I1841ec30cde142c8019830ad3190847dfe493eb9
This commit is contained in:
parent
8045b3fbd0
commit
778dba94a4
@ -65,6 +65,13 @@
|
||||
notify:
|
||||
- Restart haproxy container
|
||||
|
||||
- name: Load and persist keepalived module
|
||||
import_role:
|
||||
role: module-load
|
||||
vars:
|
||||
modules:
|
||||
- {'name': ip_vs }
|
||||
|
||||
- name: Copying over keepalived.conf
|
||||
vars:
|
||||
service: "{{ haproxy_services['keepalived'] }}"
|
||||
|
@ -1,4 +1,11 @@
|
||||
---
|
||||
- name: Load and persist iscsi_tcp module
|
||||
import_role:
|
||||
role: module-load
|
||||
vars:
|
||||
modules:
|
||||
- {'name': iscsi_tcp}
|
||||
|
||||
- name: Ensuring config directories exist
|
||||
file:
|
||||
path: "{{ node_config_directory }}/{{ item.key }}"
|
||||
|
7
ansible/roles/module-load/defaults/main.yaml
Normal file
7
ansible/roles/module-load/defaults/main.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
# Module name as a list of hashes:
|
||||
# modules:
|
||||
# - { name: foo, params: 'bar baz' }
|
||||
# - { name: starwars }
|
||||
# - { name: starwars, state: absent }
|
||||
modules: []
|
56
ansible/roles/module-load/tasks/main.yaml
Normal file
56
ansible/roles/module-load/tasks/main.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
---
|
||||
# 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
|
2
ansible/roles/module-load/templates/module-load.conf.j2
Normal file
2
ansible/roles/module-load/templates/module-load.conf.j2
Normal file
@ -0,0 +1,2 @@
|
||||
# {{ ansible_managed }}
|
||||
{{ item.name }} {{ item.params |default('') }}
|
@ -1,4 +1,11 @@
|
||||
---
|
||||
- name: Load and persist dm-multipath module
|
||||
import_role:
|
||||
role: module-load
|
||||
vars:
|
||||
modules:
|
||||
- {'name': dm-multipath}
|
||||
|
||||
- name: Ensuring config directories exist
|
||||
file:
|
||||
path: "{{ node_config_directory }}/{{ item }}"
|
||||
|
@ -1,4 +1,11 @@
|
||||
---
|
||||
- name: Load and persist openvswitch module
|
||||
import_role:
|
||||
role: module-load
|
||||
vars:
|
||||
modules:
|
||||
- {'name': openvswitch}
|
||||
|
||||
- name: Ensuring config directories exist
|
||||
become: true
|
||||
file:
|
||||
|
5
releasenotes/notes/module-load-946eaecb55cb31f0.yaml
Normal file
5
releasenotes/notes/module-load-946eaecb55cb31f0.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- Adds support for loading kernel modules required by containers. This is
|
||||
required since kolla images are removing support for loading kernel modules
|
||||
from within the container.
|
Loading…
Reference in New Issue
Block a user