Fix anteater issues of baro_tests
[barometer.git] / docker / ansible / roles / config_files / tasks / mcelog.yml
1 #Copyright 2018 OPNFV and Intel Corporation
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 - name: install mcelog package
17   package:
18      name: mcelog
19      state: present
20   ignore_errors: "true"
21   when: install_mcelog|default(false)|bool
22   tags:
23      - mcelogs
24
25 - name: start mcelog daemon if not running
26   service:
27      name: mcelog
28      state: started
29      enabled: true
30   ignore_errors: "true"
31   when: install_mcelog|default(false)|bool
32   tags:
33      - mcelogs
34
35 - name: check if mcelog running on host
36   shell: ps -ef | grep mcelog | grep -v grep > /dev/null
37   register: mcelog_running
38   ignore_errors: "true"
39   tags:
40     - mcelogs
41
42 - name: check if mcelog exists
43   shell: which mcelog > /dev/null
44   register: mcelog_exists
45   ignore_errors: "true"
46   tags:
47     - mcelogs
48
49 - name: check if mcelog-client exists
50   stat:
51     path: /var/run/mcelog-client
52   register: mcelog_client_exists
53   ignore_errors: "true"
54   tags:
55    - mcelogs
56
57 - name: enable mcelog plugin
58   template:
59     src: mcelog.conf.j2
60     dest: "{{ config_file_dir }}/mcelog.conf"
61   when: mcelog_running|succeeded and mcelog_exists|succeeded and mcelog_client_exists|succeeded
62   tags:
63     - mcelogs