26 lines
688 B
YAML
26 lines
688 B
YAML
---
|
|
- name: Get VMID
|
|
ansible.builtin.shell: >-
|
|
pct list | awk '{print $1,$3}' | grep -E '^[0-9]+ {{ proxmox_ct_name }}$'| awk '{print $1}'
|
|
args:
|
|
executable: /bin/bash
|
|
register: vmid
|
|
delegate_to: "{{ proxmox_node }}"
|
|
|
|
|
|
- name: Stop container
|
|
community.general.proxmox:
|
|
vmid: "{{ vmid.stdout }}"
|
|
api_user: "{{ proxmox_api_user }}"
|
|
api_password: "{{ proxmox_api_password }}"
|
|
api_host: "{{ proxmox_api_host }}"
|
|
state: stopped
|
|
|
|
- name: Remove container
|
|
community.general.proxmox:
|
|
vmid: "{{ vmid.stdout }}"
|
|
api_user: "{{ proxmox_api_user }}"
|
|
api_password: "{{ proxmox_api_password }}"
|
|
api_host: "{{ proxmox_api_host }}"
|
|
state: absent
|