How to Ignore warnings in ansible
13,066
I could fix it with this.
tasks:
- name: Check if Host supports Virtualization.
command: virt-host-validate qemu
register: command_result
failed_when:
- "'FAIL' in command_result.stderr"
Author by
user3398900
Updated on August 01, 2022Comments
-
user3398900 almost 2 years
I have been trying to ignore a warning while writing playbooks the scenario is i execute this
virt-host-validate qemu
and it throws up one single warning like as below.root@n0:~/playbook_promenade# virt-host-validate QEMU: Checking for hardware virtualization : PASS QEMU: Checking if device /dev/kvm exists :PASS QEMU: Checking if device /dev/kvm is accessible : PASS QEMU: Checking if device /dev/vhost-net exists : PASS QEMU: Checking if device /dev/net/tun exists : PASS QEMU: Checking for cgroup 'memory' controller support : PASS QEMU: Checking for cgroup 'memory' controller mount-point : PASS QEMU: Checking for cgroup 'cpu' controller support : PASS QEMU: Checking for cgroup 'cpu' controller mount-point: PASS QEMU: Checking for cgroup 'cpuacct' controller support : PASS QEMU: Checking for cgroup 'cpuacct' controller mount-point : PASS QEMU: Checking for cgroup 'devices' controller support : PASS QEMU: Checking for cgroup 'devices' controller mount-point : PASS QEMU: Checking for cgroup 'net_cls' controller support : PASS QEMU: Checking for cgroup 'net_cls' controller mount-point : PASS QEMU: Checking for cgroup 'blkio' controller support : PASS QEMU: Checking for cgroup 'blkio' controller mount-point : PASS QEMU: Checking for device assignment IOMMU support : WARN (No ACPI DMAR table found, IOMMU either disabled in BIOS or not supported by this hardware platform)`
The playbook i have written is as follows.
`- hosts: localhost sudo: yes tasks: - name: Check if Host supports Virtualization. command: virt-host-validate qemu ignore_errors: yes failed_when: false changed_when: false register: host_status - debug: msg: "status: {{host_status.stdout}}"`
now the worrying part is if there is any other task failing apart from the warn this playbook continues as we are using
ignore_errors: yes
can anyone please guide me how to fix it ?? thanks in advance. -
Carolus over 4 yearsMaybe it is also works if the last line is
- command_result is failed
instead.