kolla-ansible/ansible/roles/module-load/tasks/main.yml
Mark Goddard 98e8a43668 Drop support for /etc/modules
We no longer support any OS distros that use /etc/modules.

Change-Id: Ic41cad64ed0479a0cef7321aeed191fe06a30e8f
2020-08-25 20:20:57 +01:00

39 lines
1.0 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: 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"
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'