From 94890668a2e0308508100e90e2651456aadfb22b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 24 Mar 2024 22:51:37 +0100 Subject: [PATCH] [PR #8038/795a855d backport][stable-8] Added startup configuration option (#8142) Added startup configuration option (#8038) * Added startup configuration option Added the option to configure startup behavior of lxc containers. Works well in conjunction with onboot and allows to set startup order, startup delay and shutdown delay * Removed trailing whitespaces in documentation * added changelog fragment * Updated Documentation to suggested wording Co-authored-by: Felix Fontein * Improve documentation. * Fix changelog fragment. --------- Co-authored-by: Felix Fontein (cherry picked from commit 795a855d0e0b319f270f869a0b1793acaba43ea3) Co-authored-by: Michael Cicogna <44257895+miccico@users.noreply.github.com> --- changelogs/fragments/8038-proxmox-startup.yml | 2 ++ plugins/modules/proxmox.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 changelogs/fragments/8038-proxmox-startup.yml diff --git a/changelogs/fragments/8038-proxmox-startup.yml b/changelogs/fragments/8038-proxmox-startup.yml new file mode 100644 index 0000000000..f8afbc0c4e --- /dev/null +++ b/changelogs/fragments/8038-proxmox-startup.yml @@ -0,0 +1,2 @@ +minor_changes: + - proxmox - adds ``startup`` parameters to configure startup order, startup delay and shutdown delay (https://github.com/ansible-collections/community.general/pull/8038). diff --git a/plugins/modules/proxmox.py b/plugins/modules/proxmox.py index 0990169ca5..47f3faa4f2 100644 --- a/plugins/modules/proxmox.py +++ b/plugins/modules/proxmox.py @@ -81,6 +81,15 @@ options: type: list elements: str version_added: 2.0.0 + startup: + description: + - Specifies the startup order of the container. + - Use C(order=#) where C(#) is a non-negative number to define the general startup order. Shutdown in done with reverse ordering. + - Use C(up=#) where C(#) is in seconds, to specify a delay to wait before the next VM is started. + - Use C(down=#) where C(#) is in seconds, to specify a delay to wait before the next VM is stopped. + type: list + elements: str + version_added: 8.5.0 mounts: description: - specifies additional mounts (separate disks) for the container. As a hash/dictionary defining mount points @@ -761,6 +770,7 @@ def main(): ]), onboot=dict(type='bool'), features=dict(type='list', elements='str'), + startup=dict(type='list', elements='str'), storage=dict(default='local'), cpuunits=dict(type='int'), nameserver=dict(), @@ -859,6 +869,9 @@ def main(): features=",".join(module.params["features"]) if module.params["features"] is not None else None, + startup=",".join(module.params["startup"]) + if module.params["startup"] is not None + else None, description=module.params["description"], hookscript=module.params["hookscript"], timezone=module.params["timezone"], @@ -912,6 +925,7 @@ def main(): force=ansible_to_proxmox_bool(module.params['force']), pubkey=module.params['pubkey'], features=",".join(module.params['features']) if module.params['features'] is not None else None, + startup=",".join(module.params['startup']) if module.params['startup'] is not None else None, unprivileged=ansible_to_proxmox_bool(module.params['unprivileged']), description=module.params['description'], hookscript=module.params['hookscript'],