blob: efcd969d6b38fec2cbff9b3e91f6bf3dc529793f [file] [log] [blame]
Mohammed Naserab3d88b2023-04-09 17:27:05 -04001# Copyright (c) 2023 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# 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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15- name: Install package for "community.general.pids"
16 ansible.builtin.package:
17 name: python3-psutil
18
19# NOTE(mnaser): These are all processes that we do not currently have a way to
20# safely evacuate *yet*. We should remove these as we add ways
21# to evacuate them.
22- name: Get process IDs for critical services
23 community.general.pids:
24 pattern: "{{ item }}"
25 loop:
26 - ceph-mgr
27 - ceph-mon
28 - ceph-osd
29 - mysqld
30 - neutron-l3-agent
31 - qemu
32 - rabbitmq-server
33 - radosgw
34 register: _reboots_pids
35
36- name: Assert that none of these processes are running
37 ansible.builtin.assert:
38 quiet: true
39 that:
40 - item.pids | length == 0
41 fail_msg: >-
42 The following processes are running: {{ item.item }} ({{ item.pids | join(', ') }})
43 loop: "{{ _reboots_pids.results }}"
44 loop_control:
45 label: "{{ item.item }}"
46
47- name: Create a silence and reboot the host
48 block:
49 # TODO(mnaser): Create a silence inside AlertManager
50 - name: Reboot the host
51 ansible.builtin.reboot:
52 always: []
53 # TODO(mnaser): Remove the silence from AlertManager