Merge "Load known, standard kernel modules from the host, not within containers"

This commit is contained in:
Zuul 2018-10-31 17:21:56 +00:00 committed by Gerrit Code Review
commit fcc79bd685
8 changed files with 98 additions and 0 deletions

View File

@ -65,6 +65,13 @@
notify: notify:
- Restart haproxy container - Restart haproxy container
- name: Load and persist keepalived module
import_role:
role: module-load
vars:
modules:
- {'name': ip_vs }
- name: Copying over keepalived.conf - name: Copying over keepalived.conf
vars: vars:
service: "{{ haproxy_services['keepalived'] }}" service: "{{ haproxy_services['keepalived'] }}"

View File

@ -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 - name: Ensuring config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item.key }}" path: "{{ node_config_directory }}/{{ item.key }}"

View 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: []

View 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

View File

@ -0,0 +1,2 @@
# {{ ansible_managed }}
{{ item.name }} {{ item.params |default('') }}

View File

@ -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 - name: Ensuring config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item.key }}" path: "{{ node_config_directory }}/{{ item.key }}"

View File

@ -1,4 +1,11 @@
--- ---
- name: Load and persist openvswitch module
import_role:
role: module-load
vars:
modules:
- {'name': openvswitch}
- name: Ensuring config directories exist - name: Ensuring config directories exist
become: true become: true
file: file:

View 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.