--- - name: Stop LXC container module_defaults: community.proxmox.proxmox: "{{ _proxmox_api_args }}" community.proxmox.proxmox_vm_info: "{{ _proxmox_api_args }}" block: - name: Stop container if it is running community.proxmox.proxmox: vmid: "{{ lxc_vmid | default(omit) }}" hostname: "{{ lxc_hostname | default(omit) }}" state: stopped register: stop_result failed_when: |- stop_result.failed and ('not running' not in stop_result.msg) and ('does not exist' not in stop_result.msg)