forked from linux-system-roles/kdump
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3e16ae0
Showing
9 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2017 Red Hat, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
# Ansible Role: Kernel Crash Dump | ||
|
||
An ansible role which configures kdump. | ||
|
||
## Role Variables | ||
|
||
**dump_target**: Can be specified to write vmcore to a location that is not in | ||
the root file system. If `kind` is `raw` or a filesystem type, location points | ||
to a partition (by device node name, label, or uuid). For example: | ||
|
||
```yaml | ||
dump_target: | ||
kind: raw | ||
location: /dev/sda1 | ||
``` | ||
or for an `ext4` filesystem: | ||
|
||
```yaml | ||
dump_target: | ||
kind: ext4 | ||
location: "12e3e25f-534e-4007-a40c-e7e080a933ad" | ||
``` | ||
|
||
If `kind` is `ssh`, location points to a server: | ||
example: | ||
|
||
```yaml | ||
kind: ssh | ||
location: [email protected] | ||
``` | ||
|
||
Similarly for `nfs`, `location` points to an nfs server: | ||
|
||
```yaml | ||
kind: nfs | ||
location: nfs.example.com | ||
``` | ||
|
||
**path**: The path to which vmcore will be written. If `dump_target` is not | ||
null, path is relative to that dump target. Otherwise, it must be an absolute | ||
path in the root file system. | ||
|
||
**core_collector**: A command to copy the vmcore. If null, uses `makedumpfile` | ||
with options depending on the `target_type`. | ||
|
||
**action**: | ||
The action that is performed when dumping the core file fails. Can be | ||
`reboot`, `halt`, `poweroff`, or `shell`. | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
dump_target: null | ||
path: /var/crash | ||
core_collector: null | ||
action: reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: restart kdump | ||
service: name=kdump state=restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
galaxy_info: | ||
author: Baoquan He <[email protected]> | ||
description: Configure kdump | ||
galaxy_tags: [ 'system', 'beta' ] | ||
company: Red Hat, Inc. | ||
license: MIT | ||
min_ansible_version: 2.2 | ||
platforms: | ||
- name: Fedora | ||
versions: [ 24, 25 ] | ||
- name: EL | ||
versions: [ 6, 7 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Install kexec-tools | ||
package: name=kexec-tools state=present | ||
|
||
- name: Find out reserved memory for the crash kernel | ||
command: cat /sys/kernel/kexec_crash_size | ||
register: kexec_crash_size | ||
|
||
- name: Generate /etc/kdump.conf | ||
template: src=kdump.conf.j2 dest=/etc/kdump.conf backup=yes | ||
when: kexec_crash_size.stdout|int > 0 | ||
notify: restart kdump | ||
|
||
- name: Generate /etc/sysconfig/kdump | ||
template: src=kdump.j2 dest=/etc/sysconfig/kdump backup=yes | ||
when: kexec_crash_size.stdout|int > 0 | ||
notify: restart kdump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# {{ ansible_managed }} | ||
# Last modified: {{ ansible_date_time.date }} {{ ansible_date_time.time }} | ||
|
||
{% if dump_target %} | ||
{{dump_target.kind}} {{dump_target.location}} | ||
{% endif %} | ||
path {{path}} | ||
{% if core_collector %} | ||
core_collector {{core_collector}} | ||
{% endif %} | ||
default {{action}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# {{ ansible_managed }} | ||
# Last modified: {{ ansible_date_time.date }} {{ ansible_date_time.time }} | ||
|
||
{% if ansible_distribution == 'Fedora' or (ansible_distribution == 'RedHat' and ansible_distribution_version|int >= 7) %} | ||
|
||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet" | ||
|
||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never" | ||
|
||
{% elif ansible_distribution == 'RedHat' and ansible_distribution_version|int < 7 %} | ||
|
||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off acpi_no_memhotplug" | ||
|
||
MKDUMPRD_ARGS="" | ||
|
||
KDUMP_BOOTDIR="/boot" | ||
|
||
{% endif %} | ||
|
||
KDUMP_KERNELVER="" | ||
|
||
KDUMP_COMMANDLINE="" | ||
|
||
KEXEC_ARGS="" | ||
|
||
KDUMP_IMG="vmlinuz" | ||
|
||
KDUMP_IMG_EXT="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
- name: Ensure that the rule runs with default parameters | ||
hosts: all | ||
|
||
roles: | ||
- kdump |