Replace ignore_errors with failed_when

This commit is contained in:
Sandwich 2024-10-28 18:56:00 +01:00
parent a3b772c543
commit 5312ec8cc6
4 changed files with 4 additions and 4 deletions

View File

@ -87,4 +87,4 @@
- name: Reboot system
when: hypervisor != "libvirt"
ansible.builtin.command: reboot
ignore_errors: true
failed_when: false

View File

@ -20,7 +20,7 @@
- name: Remove CD-ROM from VM in vCenter
when: hypervisor == "vmware"
delegate_to: localhost
ignore_errors: true
failed_when: false
community.vmware.vmware_guest:
hostname: "{{ hypervisor_url }}"
username: "{{ hypervisor_username }}"

View File

@ -111,7 +111,7 @@
- name: Extra Configuration
block:
- name: Append lines to vimrc
ignore_errors: true
failed_when: false
ansible.builtin.lineinfile:
path: "{{ '/mnt/etc/vim/vimrc' if os | lower in ['debian11', 'debian12', 'ubuntu', 'ubuntu-lts'] else '/mnt/etc/vimrc' }}"
line: "{{ item }}"

View File

@ -2,7 +2,7 @@
- name: Partition install drive
block:
- name: Prepare partitions
ignore_errors: true
failed_when: false
ansible.builtin.command: "{{ item.cmd }}"
loop:
- { cmd: umount -l /mnt }