Merge "Tighten up how we add and remove kernel modules"
This commit is contained in:
commit
231aa5316d
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
- name: Modules reload
|
||||
become: true
|
||||
systemd:
|
||||
name: systemd-modules-load.service
|
||||
state: restarted
|
|
@ -1,63 +1,49 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
name: delegated
|
||||
options:
|
||||
managed: false
|
||||
login_cmd_template: >-
|
||||
ssh
|
||||
-o UserKnownHostsFile=/dev/null
|
||||
-o StrictHostKeyChecking=no
|
||||
-o Compression=no
|
||||
-o TCPKeepAlive=yes
|
||||
-o VerifyHostKeyDNS=no
|
||||
-o ForwardX11=no
|
||||
-o ForwardAgent=no
|
||||
{instance}
|
||||
ansible_connection_options:
|
||||
ansible_connection: ssh
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos7
|
||||
hostname: centos7
|
||||
image: centos:7
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python-setuptools
|
||||
easy_install:
|
||||
- pip
|
||||
environment: &env
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
|
||||
- name: fedora28
|
||||
hostname: fedora28
|
||||
image: fedora:28
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python*-setuptools
|
||||
environment:
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
privileged: true
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
- name: instance
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
config_options:
|
||||
defaults:
|
||||
fact_caching: jsonfile
|
||||
fact_caching_connection: /tmp/molecule/facts
|
||||
inventory:
|
||||
hosts:
|
||||
all:
|
||||
hosts:
|
||||
instance:
|
||||
ansible_host: localhost
|
||||
log: true
|
||||
env:
|
||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
|
||||
|
||||
scenario:
|
||||
name: default
|
||||
test_sequence:
|
||||
- destroy
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
- destroy
|
||||
|
||||
lint:
|
||||
enabled: false
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
- role: test_deps
|
||||
post_tasks:
|
||||
- name: Install additional dependencies
|
||||
become: true
|
||||
package:
|
||||
name: kmod
|
||||
state: present
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
name: delegated
|
||||
options:
|
||||
managed: false
|
||||
login_cmd_template: >-
|
||||
ssh
|
||||
-o UserKnownHostsFile=/dev/null
|
||||
-o StrictHostKeyChecking=no
|
||||
-o Compression=no
|
||||
-o TCPKeepAlive=yes
|
||||
-o VerifyHostKeyDNS=no
|
||||
-o ForwardX11=no
|
||||
-o ForwardAgent=no
|
||||
{instance}
|
||||
ansible_connection_options:
|
||||
ansible_connection: ssh
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos7
|
||||
hostname: centos7
|
||||
image: centos:7
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python-setuptools
|
||||
easy_install:
|
||||
- pip
|
||||
environment: &env
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
|
||||
- name: fedora28
|
||||
hostname: fedora28
|
||||
image: fedora:28
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python*-setuptools
|
||||
environment:
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
privileged: true
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
- name: instance
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
config_options:
|
||||
defaults:
|
||||
fact_caching: jsonfile
|
||||
fact_caching_connection: /tmp/molecule/facts
|
||||
inventory:
|
||||
hosts:
|
||||
all:
|
||||
hosts:
|
||||
instance:
|
||||
ansible_host: localhost
|
||||
log: true
|
||||
env:
|
||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
|
||||
|
||||
scenario:
|
||||
name: legacy_vars
|
||||
test_sequence:
|
||||
- destroy
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
- destroy
|
||||
|
||||
lint:
|
||||
enabled: false
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
- role: test_deps
|
||||
post_tasks:
|
||||
- name: Install additional dependencies
|
||||
become: true
|
||||
package:
|
||||
name: kmod
|
||||
state: present
|
||||
|
|
|
@ -1,63 +1,49 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
name: delegated
|
||||
options:
|
||||
managed: false
|
||||
login_cmd_template: >-
|
||||
ssh
|
||||
-o UserKnownHostsFile=/dev/null
|
||||
-o StrictHostKeyChecking=no
|
||||
-o Compression=no
|
||||
-o TCPKeepAlive=yes
|
||||
-o VerifyHostKeyDNS=no
|
||||
-o ForwardX11=no
|
||||
-o ForwardAgent=no
|
||||
{instance}
|
||||
ansible_connection_options:
|
||||
ansible_connection: ssh
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos7
|
||||
hostname: centos7
|
||||
image: centos:7
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python-setuptools
|
||||
easy_install:
|
||||
- pip
|
||||
environment: &env
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
|
||||
- name: fedora28
|
||||
hostname: fedora28
|
||||
image: fedora:28
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python*-setuptools
|
||||
environment:
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
command: /sbin/init
|
||||
privileged: true
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
capabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- /dev:/dev
|
||||
- /lib/modules:/lib/modules
|
||||
- name: instance
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
config_options:
|
||||
defaults:
|
||||
fact_caching: jsonfile
|
||||
fact_caching_connection: /tmp/molecule/facts
|
||||
inventory:
|
||||
hosts:
|
||||
all:
|
||||
hosts:
|
||||
instance:
|
||||
ansible_host: localhost
|
||||
log: true
|
||||
env:
|
||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
|
||||
|
||||
scenario:
|
||||
name: remove_module
|
||||
test_sequence:
|
||||
- destroy
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
- destroy
|
||||
|
||||
lint:
|
||||
enabled: false
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
- role: test_deps
|
||||
post_tasks:
|
||||
- name: Install additional dependencies
|
||||
become: true
|
||||
package:
|
||||
name: kmod
|
||||
state: present
|
||||
|
|
|
@ -17,60 +17,53 @@
|
|||
|
||||
# "tripleo-module-load" will search for and load any operating system variable file
|
||||
|
||||
- name: Check whether /etc/modules-load.d exists
|
||||
stat:
|
||||
path: /etc/modules-load.d
|
||||
register: modules_load_stat
|
||||
|
||||
- name: Check whether /etc/modules-load.d exists
|
||||
stat:
|
||||
path: /etc/modules
|
||||
register: modules_file
|
||||
|
||||
- name: "Load modules"
|
||||
- name: Kernel module block
|
||||
become: true
|
||||
modprobe:
|
||||
name: "{{ item.name }}"
|
||||
params: "{{ item.params | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
block:
|
||||
- name: Ensure /etc/modules-load.d exists
|
||||
file:
|
||||
path: /etc/modules-load.d
|
||||
state: directory
|
||||
setype: etc_t
|
||||
selevel: s0
|
||||
|
||||
- name: "Persist modules via modules-load.d"
|
||||
become: true
|
||||
template:
|
||||
dest: "/etc/modules-load.d/{{ item.name }}.conf"
|
||||
src: module-load.conf.j2
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when:
|
||||
- modules_load_stat.stat.exists | bool
|
||||
- (item.state | default('present')) == 'present'
|
||||
- name: "Load modules"
|
||||
modprobe:
|
||||
name: "{{ item.name }}"
|
||||
params: "{{ item.params | default(omit) }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: "Drop module persistence"
|
||||
become: true
|
||||
file:
|
||||
path: "/etc/modules-load.d/{{ item.name }}.conf"
|
||||
state: absent
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when:
|
||||
- modules_load_stat.stat.exists | bool
|
||||
- (item.state | default('present')) == 'absent'
|
||||
- name: "Persist modules via modules-load.d"
|
||||
template:
|
||||
dest: "/etc/modules-load.d/{{ item.name }}.conf"
|
||||
src: module-load.conf.j2
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
notify:
|
||||
- Modules reload
|
||||
when:
|
||||
- (item.state | default('present')) == 'present'
|
||||
|
||||
- name: "Set modules persistence via /etc/modules"
|
||||
become: true
|
||||
lineinfile:
|
||||
dest: /etc/modules
|
||||
line: "{{ item.name }} {{ item.params | default('') }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when:
|
||||
- modules_file.stat.exists | bool
|
||||
- (modules_file.stat.isdir is defined) and
|
||||
not (modules_file.stat.isdir | bool)
|
||||
- name: "Drop module persistence"
|
||||
file:
|
||||
path: "/etc/modules-load.d/{{ item.name }}.conf"
|
||||
state: absent
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when:
|
||||
- (item.state | default('present')) == 'absent'
|
||||
|
||||
- name: "Set modules persistence via /etc/modules"
|
||||
lineinfile:
|
||||
dest: /etc/modules
|
||||
line: "{{ item.name }} {{ item.params | default('') }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
create: true
|
||||
loop: "{{ tripleo_modules }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
|
Loading…
Reference in New Issue