qiyutech.proxmox.hl_qemu_vm module – QEMU 虚拟机 创建/删除 接口

备注

This module is part of the qiyutech.proxmox collection (version 1.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install qiyutech.proxmox.

To use it in a playbook, specify: qiyutech.proxmox.hl_qemu_vm.

1.0.0 新版功能: of qiyutech.proxmox

Synopsis

  • 创建、获取 QEMU 虚拟机的状态

备注

This module has a corresponding action plugin.

Parameters

Parameter

Comments

agent

integer

启用 QEMU 代理

bridge

string

网络桥接名称

例如: vmbr0

cores

integer

CPU核心数量

disk_size

integer

磁盘大小

单位: GB

host

string / required

Proxmox API server

这个参数是必须的

参数获取顺序:

1 host 任务参数

2 proxmox_host 变量 (aka: task_vars 中的 proxmox_host 变量)

3 PROXMOX_HOST 任务环境变量

4 PROXMOX_HOST 全局环境变量

memory

integer

内存大小

单位: MB

name

string

虚拟机的名称

node

string / required

PVE集群节点名称

numa

integer

启用 numa

ostype

string

操作系统类型

Specify guest operating system. This is used to enable special

optimization/features for specific operating systems:

other: unspecified OS

win7: Microsoft Windows 7

win8: Microsoft Windows 8/2012/2012r2

win10: Microsoft Windows 10/2016/2019

l24: Linux 2.4 Kernel

l26: Linux 2.6 - 5.X Kernel

solaris: Solaris/OpenSolaris/OpenIndiania kernel

Choices:

  • l24

  • l26

  • win7

  • win8

  • win10

  • other

  • solaris

sockets

integer

CPU数量

Default: 1

state

string

虚拟机的状态

present 如果不存在则创建此虚拟机

absent 如果存在则删除此虚拟机

Choices:

  • present ← (default)

  • absent

token_id

string / required

Proxmox API Token ID

这个参数是必须的

参数获取顺序:

1 token_id 任务参数

2 proxmox_token_id 变量 (aka: task_vars 中的 proxmox_token_id 变量)

3 PROXMOX_TOKEN_ID 任务环境变量

4 PROXMOX_TOKEN_ID 全局环境变量

token_secret

string / required

Proxmox API Token Secret

这个参数是必须的

参数获取顺序:

1 token_secret 任务参数

2 proxmox_token_secret 变量 (aka: task_vars 中的 proxmox_token_secret 变量)

3 PROXMOX_TOKEN_SECRET 任务环境变量

4 PROXMOX_TOKEN_SECRET 全局环境变量

vga

string

VGA设置

格式为:

type=xxx,memory=xxx

内存大小单位为: MB

Ubuntu 无法自动启动的问题 [需要设置: vga: type=vmware]:

https://forum.proxmox.com/threads/ubuntu-desktop-vm-stuck.67269/

vga type source code: https://github.com/proxmox/qemu-server/blob/master/PVE/QemuServer.pm#L192

当前支持的类型: cirrus qxl qxl2 qxl3 qxl4 none serial0 serial1 serial2 serial3 std virtio vmware

vmid

integer / required

虚拟机ID

Examples

- name: Test with a message
  qiyutech.proxmox.hl_qemu_vm:
    host: https://proxmox.ksle.2cc.net
    token_id: 'root@pam!demo'
    token_secret: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

Authors

  • dev