Adding multiples ansible roles, playbooks and inventory

This commit is contained in:
2026-02-26 22:06:15 +00:00
parent d0a13e6f62
commit a4ccfe25ae
23 changed files with 1195 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
---
- name: Create new container
community.general.proxmox:
node: "{{ proxmox_node }}"
api_host: "{{ proxmox_api_host }}"
api_user: "{{ proxmox_api_user }}"
api_password: "{{ proxmox_api_password }}"
hostname: "{{ proxmox_ct_create_hostname }}"
pubkey: "{{ proxmox_ct_create_pubkey }}"
ostemplate: "{{ proxmox_ct_create_ostemplate }}"
cores: 2
memory: "{{ proxmox_ct_create_ram }}"
swap: "{{ proxmox_ct_create_swap}}"
netif: "{{ proxmox_ct_create_net_config }}"
vmid: "{{ proxmox_ct_create_vmid | default(999999) }}"
tags: "{{ proxmox_ct_create_tags}}"
...

View 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

View File

@@ -0,0 +1,18 @@
---
- name: Proxmox Create new container
ansible.builtin.include_tasks:
file: ct_create.yml
apply:
tags:
- ct_create
tags:
- always
- name: Proxmox Remove contrainer
ansible.builtin.include_tasks:
file: ct_remove.yml
apply:
tags:
- ct_remove
tags:
- always

View File

@@ -0,0 +1,4 @@
---
- name: Testing
ansible.builtin.debug:
msg: "nzefùînfùaineaùzifnazùeifnaze"