[ansible] remove deprecated filters
[barometer.git] / docker / ansible / roles / config_files / tasks / mcelog.yml
1 # Copyright 2018-2019 Intel Corporation and OPNFV. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 ---
16
17 - name: install mcelog package
18   package:
19      name: mcelog
20      state: present
21   ignore_errors: "true"
22   when: install_mcelog|default(false)|bool
23   tags:
24      - mcelogs
25
26 - name: check if mcelog present
27   shell: which mcelog > /dev/null
28   register: mcelog_present
29   ignore_errors: "true"
30   when: install_mcelog|default(false)|bool
31   tags:
32      - mcelogs
33
34 - name: build mcelog from sources if not in package
35   import_tasks: make_mcelog.yml
36   when: (mcelog_present is failed) and (install_mcelog|default(false)|bool)
37   tags:
38      - mcelogs
39
40 - name: start mcelog daemon if not running
41   service:
42      name: mcelog
43      state: started
44      enabled: true
45   ignore_errors: "true"
46   when: install_mcelog|default(false)|bool
47   tags:
48      - mcelogs
49
50 - name: check if mcelog running on host
51   shell: ps -ef | grep mcelog | grep -v grep > /dev/null
52   register: mcelog_running
53   ignore_errors: "true"
54   tags:
55     - mcelogs
56
57 - name: check if mcelog exists
58   shell: which mcelog > /dev/null
59   register: mcelog_exists
60   ignore_errors: "true"
61   tags:
62     - mcelogs
63
64 - name: check if mcelog-client exists
65   stat:
66     path: /var/run/mcelog-client
67   register: mcelog_client_exists
68   ignore_errors: "true"
69   tags:
70    - mcelogs
71
72 - name: enable mcelog plugin
73   template:
74     src: mcelog.conf.j2
75     dest: "{{ config_file_dir }}/mcelog.conf"
76   when: (mcelog_running is succeeded) and (mcelog_exists is succeeded) and (mcelog_client_exists is succeeded)
77   tags:
78           - mcelogs