Initial commit
[ta/infra-ansible.git] / roles / core-handling-config / tasks / main.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 - name: Create coredump directory to log volume
18   file: path=/var/log/coredump state=directory
19
20 - name: Remote old coredump directory
21   file: path=/var/lib/systemd/coredump state=absent 
22
23 - name: Create link so that coredumps go to log volume
24   file:
25     src: '/var/log/coredump'
26     dest: '/var/lib/systemd/coredump'
27     state: link
28
29 - name: Create coredump configuration directory
30   file: path=/etc/systemd/coredump.conf.d state=directory
31
32 - name: Enable core files
33   copy:
34     src: "01-enable-cores.conf"
35     dest: "/etc/systemd/coredump.conf.d/01-enable-cores.conf"
36     owner: "root"
37     group: "root"
38   tags:
39     - core-handling-config
40
41 - name: Enable only backtraces
42   copy:
43     src: "02-only-backtrace.conf"
44     dest: "/etc/systemd/coredump.conf.d/02-only-backtrace.conf"
45     owner: "root"
46     group: "root"
47   tags:
48     - core-handling-config
49
50 - name: Enable core dumping
51   sysctl:
52     name: kernel.core_pattern 
53     value: '|/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %e'
54     sysctl_file: /etc/sysctl.d/50-coredump.conf
55