proxmox-container-exists
Description
Ensure a container exists on a Proxmox server.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | Proxmox host ip/domain. Required |
|
string | -- | Proxmox api password. Required |
|
string | -- | Proxmox api username (incl. @pve or @pam). Required |
|
string | -- | gateway address for container Required |
|
string | -- | ip address for container Required |
|
string | -- | The hostname of the container. Required |
|
string | -- | Name/path of the container image template, example: 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz'. Required |
|
string | vmbr0 | Name of bridge to use for container network |
|
string | -- | Public ssh key to put into /root/.ssh/authorized_keys |
|
string | -- | The root password of the newly created container. |
|
string | pve | Proxmox VE node, when new VM will be created. |
|
boolean | -- | Whether to start the container on boot or not. |
|
boolean | True | Whether the container should be started. |
|
string | local | The target storage where the container filesystem will live. |
|
integer | -- | The vmid of the container. |
Code
doc: short_help: Ensure a container exists on a Proxmox server. args: hostname: doc: The hostname of the container. type: string required: true vmid: doc: The vmid of the container. type: integer required: false node: doc: Proxmox VE node, when new VM will be created. type: string required: true default: pve api_user: doc: Proxmox api username (incl. @pve or @pam). type: string required: true api_password: doc: Proxmox api password. type: string required: true secret: true api_host: doc: Proxmox host ip/domain. type: string required: true start_on_boot: doc: Whether to start the container on boot or not. type: boolean required: false cli: param_decls: - --start_on-boot container_root_password: doc: The root password of the newly created container. type: string required: false secret: true storage: doc: The target storage where the container filesystem will live. default: local required: true type: string container_ip: doc: ip address for container type: string required: true container_gateway: doc: gateway address for container type: string required: true container_bridge: doc: Name of bridge to use for container network type: string default: vmbr0 required: true template: doc: "Name/path of the container image template, example: 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz'." type: string required: true started: doc: Whether the container should be started. type: boolean default: true required: false container_root_authorized_key: doc: Public ssh key to put into /root/.ssh/authorized_keys type: string required: false frecklets: - frecklet: name: proxmox type: ansible-module resources: python-package: - proxmoxer - requests task: become: false delegate_to: localhost vars: vmid: '{{:: vmid ::}}' node: '{{:: node ::}}' api_user: '{{:: api_user ::}}' api_password: '{{:: api_password ::}}' api_host: '{{:: api_host ::}}' password: '{{:: container_root_password ::}}' hostname: '{{:: hostname ::}}' onboot: "{{:: start_on_boot | string_for_boolean('true', 'false') ::}}" storage: '{{:: storage ::}}' state: present netif: '{"net0":"name=eth0,gw={{:: container_gateway ::}},ip={{:: container_ip ::}}/24,bridge={{:: container_bridge ::}}"}' ostemplate: '{{:: template ::}}' pubkey: '{{:: container_root_authorized_key ::}}' - frecklet: name: proxmox type: ansible-module skip: '{{:: started | negate ::}}' resources: python-package: - proxmoxer - requests task: become: false delegate_to: localhost vars: hostname: '{{:: hostname ::}}' vmid: '{{:: vmid ::}}' state: started api_user: '{{:: api_user ::}}' api_password: '{{:: api_password ::}}' api_host: '{{:: api_host ::}}'
frecklecute --community proxmox-container-exists --help Usage: frecklecute proxmox-container-exists [OPTIONS] Ensure a container exists on a Proxmox server. Options: --api-host API_HOST Proxmox host ip/domain. [required] --api-password API_PASSWORD Proxmox api password. [required] --api-user API_USER Proxmox api username (incl. @pve or @pam). [required] --container-gateway CONTAINER_GATEWAY gateway address for container [required] --container-ip CONTAINER_IP ip address for container [required] --hostname HOSTNAME The hostname of the container. [required] --template TEMPLATE Name/path of the container image template, example: 'local:vztmpl/debian-10.0-standard_ 10.0-1_amd64.tar.gz'. [required] --container-bridge CONTAINER_BRIDGE Name of bridge to use for container network --container-root-authorized-key CONTAINER_ROOT_AUTHORIZED_KEY Public ssh key to put into /root/.ssh/authorized_keys --container-root-password CONTAINER_ROOT_PASSWORD The root password of the newly created container. --node NODE Proxmox VE node, when new VM will be created. --start_on-boot Whether to start the container on boot or not. --started / --no-started Whether the container should be started. --storage STORAGE The target storage where the container filesystem will live. --vmid VMID The vmid of the container. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.proxmox_container_exists.ProxmoxContainerExists # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class ProxmoxContainerExists(AutoPycklet): """Ensure a container exists on a Proxmox server. Args: api_host: Proxmox host ip/domain. api_password: Proxmox api password. api_user: Proxmox api username (incl. @pve or @pam). container_bridge: Name of bridge to use for container network container_gateway: gateway address for container container_ip: ip address for container container_root_authorized_key: Public ssh key to put into /root/.ssh/authorized_keys container_root_password: The root password of the newly created container. hostname: The hostname of the container. node: Proxmox VE node, when new VM will be created. start_on_boot: Whether to start the container on boot or not. started: Whether the container should be started. storage: The target storage where the container filesystem will live. template: Name/path of the container image template, example: 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz'. vmid: The vmid of the container. """ FRECKLET_ID = "proxmox-container-exists" api_host: str = None api_password: str = None api_user: str = None container_bridge: str = None container_gateway: str = None container_ip: str = None container_root_authorized_key: str = None container_root_password: str = None hostname: str = None node: str = None start_on_boot: bool = None started: bool = None storage: str = None template: str = None vmid: int = None def __post_init__(self): super(ProxmoxContainerExists, self).__init__(var_names=["api_host", "api_password", "api_user", "container_bridge", "container_gateway", "container_ip", "container_root_authorized_key", "container_root_password", "hostname", "node", "start_on_boot", "started", "storage", "template", "vmid"]) frecklet_class = ProxmoxContainerExists
# -*- coding: utf-8 -*- # # module path: pycklets.proxmox_container_exists.ProxmoxContainerExists # from pyckles import AutoPycklet class ProxmoxContainerExists(AutoPycklet): """Ensure a container exists on a Proxmox server. Args: api_host: Proxmox host ip/domain. api_password: Proxmox api password. api_user: Proxmox api username (incl. @pve or @pam). container_bridge: Name of bridge to use for container network container_gateway: gateway address for container container_ip: ip address for container container_root_authorized_key: Public ssh key to put into /root/.ssh/authorized_keys container_root_password: The root password of the newly created container. hostname: The hostname of the container. node: Proxmox VE node, when new VM will be created. start_on_boot: Whether to start the container on boot or not. started: Whether the container should be started. storage: The target storage where the container filesystem will live. template: Name/path of the container image template, example: 'local:vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz'. vmid: The vmid of the container. """ FRECKLET_ID = "proxmox-container-exists" def __init__(self, api_host=None, api_password=None, api_user=None, container_bridge="vmbr0", container_gateway=None, container_ip=None, container_root_authorized_key=None, container_root_password=None, hostname=None, node="pve", start_on_boot=None, started=True, storage="local", template=None, vmid=None): super(ProxmoxContainerExists, self).__init__(var_names=["api_host", "api_password", "api_user", "container_bridge", "container_gateway", "container_ip", "container_root_authorized_key", "container_root_password", "hostname", "node", "start_on_boot", "started", "storage", "template", "vmid"]) self._api_host = api_host self._api_password = api_password self._api_user = api_user self._container_bridge = container_bridge self._container_gateway = container_gateway self._container_ip = container_ip self._container_root_authorized_key = container_root_authorized_key self._container_root_password = container_root_password self._hostname = hostname self._node = node self._start_on_boot = start_on_boot self._started = started self._storage = storage self._template = template self._vmid = vmid @property def api_host(self): return self._api_host @api_host.setter def api_host(self, api_host): self._api_host = api_host @property def api_password(self): return self._api_password @api_password.setter def api_password(self, api_password): self._api_password = api_password @property def api_user(self): return self._api_user @api_user.setter def api_user(self, api_user): self._api_user = api_user @property def container_bridge(self): return self._container_bridge @container_bridge.setter def container_bridge(self, container_bridge): self._container_bridge = container_bridge @property def container_gateway(self): return self._container_gateway @container_gateway.setter def container_gateway(self, container_gateway): self._container_gateway = container_gateway @property def container_ip(self): return self._container_ip @container_ip.setter def container_ip(self, container_ip): self._container_ip = container_ip @property def container_root_authorized_key(self): return self._container_root_authorized_key @container_root_authorized_key.setter def container_root_authorized_key(self, container_root_authorized_key): self._container_root_authorized_key = container_root_authorized_key @property def container_root_password(self): return self._container_root_password @container_root_password.setter def container_root_password(self, container_root_password): self._container_root_password = container_root_password @property def hostname(self): return self._hostname @hostname.setter def hostname(self, hostname): self._hostname = hostname @property def node(self): return self._node @node.setter def node(self, node): self._node = node @property def start_on_boot(self): return self._start_on_boot @start_on_boot.setter def start_on_boot(self, start_on_boot): self._start_on_boot = start_on_boot @property def started(self): return self._started @started.setter def started(self, started): self._started = started @property def storage(self): return self._storage @storage.setter def storage(self, storage): self._storage = storage @property def template(self): return self._template @template.setter def template(self, template): self._template = template @property def vmid(self): return self._vmid @vmid.setter def vmid(self, vmid): self._vmid = vmid frecklet_class = ProxmoxContainerExists