Adding multiples ansible roles, playbooks and inventory
This commit is contained in:
25
roles/proxmox/tasks/ct_remove.yml
Normal file
25
roles/proxmox/tasks/ct_remove.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- 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
|
||||
Reference in New Issue
Block a user