Skip to content

Commit a646717

Browse files
Allow import content templates (#162)
* Allow 'import' as content_type for template module * added examples for iso and import content_type * Fix wrong content_type in example Co-authored-by: Jeffrey van Pelt <[email protected]> * Create changelog fragment --------- Co-authored-by: Jeffrey van Pelt <[email protected]>
1 parent 6099b49 commit a646717

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- proxmox_template - Add 'import' to allowed content types of proxmox_template, so disk images and can be used as disk images on VM creation (https://github.com/ansible-collections/community.proxmox/pull/162).

plugins/modules/proxmox_template.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
type: str
4343
content_type:
4444
description:
45-
- Content type.
46-
- Required only for O(state=present).
45+
- Content type of the template.
46+
- Valid values are V(vztmpl) for LXC container templates, V(iso) for ISO disc images, and V(import) for harddisk images and Open Virtual Appliances (OVA).
4747
type: str
4848
default: 'vztmpl'
49-
choices: ['vztmpl', 'iso']
49+
choices: ['vztmpl', 'import', 'iso']
5050
storage:
5151
description:
5252
- Target storage.
@@ -168,6 +168,24 @@
168168
url: ubuntu-20.04-standard_20.04-1_amd64.tar.gz
169169
checksum_algorithm: sha256
170170
checksum: 65d860160bdc9b98abf72407e14ca40b609417de7939897d3b58d55787aaef69
171+
172+
- name: Upload new disk image template with minimal options
173+
community.proxmox.proxmox_template:
174+
node: uk-mc02
175+
api_user: root@pam
176+
api_password: 1q2w3e
177+
api_host: node1
178+
content_type: import
179+
src: debian-13-genericcloud-amd64.qcow2
180+
181+
- name: Upload new ISO with minimal options
182+
community.proxmox.proxmox_template:
183+
node: uk-mc02
184+
api_user: root@pam
185+
api_password: 1q2w3e
186+
api_host: node1
187+
content_type: iso
188+
src: proxmox.iso
171189
"""
172190

173191
import os
@@ -279,7 +297,7 @@ def main():
279297
src=dict(type='path'),
280298
url=dict(),
281299
template=dict(),
282-
content_type=dict(default='vztmpl', choices=['vztmpl', 'iso']),
300+
content_type=dict(default='vztmpl', choices=['vztmpl', 'iso', 'import']),
283301
storage=dict(default='local'),
284302
timeout=dict(type='int', default=30),
285303
force=dict(type='bool', default=False),

0 commit comments

Comments
 (0)