kayobe/ansible/wipe-disks.yml
Mark Goddard cb48f7e5d2 Refactor host configure commands to use a single playbook
Ansible failure handling is different when executing multiple top-level
playbooks (CLI arguments) vs. multiple plays within a top-level
playbook. If any hosts have failed or are unreachable at the end of a
top-level playbook, then ansible-playbook exits non-zero.

In contrast, execution will continue at the end of a mid-playbook play
if there are hosts that have not failed or become unreachable. This is
documented in [1].

Currently, Kayobe executes multiple top-level playbooks, most notably in
the host configure commands where there is a long list of them. This has
implications when working at scale, where failures are more common. If a
host fails at any point, then execution of the command will stop at the
end of the current playbook. This means that the command must be run
again for all hosts. Additionally, if any hosts are unreachable, then
the command is unable to progress at all without removing them from the
inventory.

This change refactors the host configure and host upgrade commands to
use a single top-level playbook.

[1] https://github.com/markgoddard/ansible-experiments/tree/master/14-error-handling

Story: 2009854
Task: 44482

Change-Id: Ia63d66097b10b6ddda30ad693636143f8b1a85e0
2022-02-22 09:22:09 +00:00

26 lines
815 B
YAML

---
# Warning! This play can result in lost data. Take care when developing and
# using it.
# Initialisation task to be applied on first boot of a system to initalise
# disks. We search for block devices that are not currently mounted, then wipe
# any LVM or file system state from them. Any associated dm-crypt devices are
# also closed and removed from crypttab.
- name: Ensure that all unmounted block devices are wiped
hosts: seed-hypervisor:seed:overcloud:infra-vms
tags:
- wipe-disks
tasks:
- block:
- name: Tear down unmounted LUKS devices
include_role:
name: stackhpc.luks
vars:
luks_action: teardown-unmounted
- name: Wipe disks
include_role:
name: wipe-disks
when: wipe_disks | default(false) | bool