Files
ansible-collection-infrastr…/roles/proxmox-lxc-provision/tasks/stop.yml

13 lines
389 B
YAML
Executable File

---
- name: Stop container if it is running
community.general.proxmox:
<<: "{{ proxmox_api_connection }}"
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)