--- argument_specs: main: short_description: Manage a Proxmox LXC container description: - >- Detects the container through the Proxmox API, validates C(pve_lxc_raw_config), deletes the container when C(pve_lxc_state) is absent and C(pve_lxc_allow_destroy) is true, otherwise creates it when missing, updates its configuration and disk, reconciles the raw C(lxc.*) lines in C(/etc/pve/lxc/.conf), applies the power state and waits for SSH when the container is started. - >- When C(pve_lxc_manage_lifecycle) is false the role only sets C(pve_lxc_exists) and C(pve_lxc_present) to true and does nothing else, so none of the Proxmox inputs below is read. This is how a container on a node Ansible does not manage is handled. - >- API calls run on localhost and authenticate with C(pve_lxc_api_user) (bare user name, C(@) is appended), C(pve_lxc_api_token_id), C(pve_lxc_api_token_secret) and C(pve_lxc_api_host), applied through C(module_defaults), and with the header C(PVEAPIToken=@!=) for the C(uri) calls, which the role derives from them in C(vars/main.yml) (internal, not an input). The user and the token secret have no usable default: they are asserted non-empty in the input validation, only for a container with C(pve_lxc_manage_lifecycle) true. The caller sets them. The raw config, disk filesystem resize and the C(pct) call are delegated to C(pve_lxc_node) with become. C(community.proxmox) and, on the controller, the Python library C(proxmoxer) must be installed. TLS certificates are not verified. - >- Also reads C(ansible_host) (container address and SSH wait), C(inventory_hostname) (container hostname) and C(ansible_check_mode). The role sets the facts C(pve_lxc_exists) and C(pve_lxc_present) for later plays. C(pve_lxc_present) is true only while the container exists and C(pve_lxc_state) is not absent. options: pve_lxc_state: type: str default: present choices: [present, started, stopped, absent] description: - >- C(present) keeps the container configured without touching its power state. C(started) and C(stopped) also apply the power state, and C(started) additionally waits for SSH when C(pve_lxc_wait_for_ssh) is true. C(absent) deletes the container, but only when C(pve_lxc_allow_destroy) is true. pve_lxc_manage_lifecycle: type: bool default: true description: - >- When false the container is treated as present and every lifecycle task is skipped. Set it for containers on a node Ansible does not manage. pve_lxc_allow_destroy: type: bool default: false description: - Safety switch required before C(pve_lxc_state=absent) deletes the container. pve_lxc_wait_for_ssh: type: bool default: true description: - When true and C(pve_lxc_state) is started, wait for SSH on port 22 of C(ansible_host). pve_lxc_manage_disk: type: bool default: false description: - >- Allow the root disk to be grown to the size in C(pve_lxc_disk). Growing fails the play when Proxmox does not apply it, and runs C(pct resize) on C(pve_lxc_node). pve_lxc_pubkey: type: str default: "" description: - Public keys installed for root by the container creation and update, one per line. pve_lxc_features: type: list elements: str default: [] description: - >- Proxmox container features such as C(nesting=1) or C(keyctl=1). Omitted when empty. Proxmox applies a change only on the next start, and lets an API user other than C(root@pam) change only some of them, such as C(nesting). pve_lxc_restart_on_config_change: type: bool default: false description: - Restart the container when the configuration update reports a change. Off by default so routine drift does not restart guests. pve_lxc_cmode: type: str default: tty description: - Console mode sent on update. Sent explicitly because community.proxmox 2.0.0 otherwise forwarded a value Proxmox rejects. pve_lxc_raw_config: type: raw default: [] description: - >- Raw C(lxc.*) lines for the container config, one per list item, each a single line starting with C(lxc.). The role default is an empty list. Anything that is not a list of such strings fails the play, except an empty or null value, which is treated as an empty list and removes every C(lxc.*) line that is present. The validation also runs in check mode on a container that does not exist yet. A change restarts the container (outside check mode, unless C(pve_lxc_state) is stopped), independent of C(pve_lxc_restart_on_config_change). pve_lxc_onboot: type: bool default: true description: - >- Start the container when the node boots, for a container whose C(pve_lxc_state) is C(started) or C(present). A C(stopped) container always gets C(onboot=0), whatever this says, so a node reboot does not start it. Sent on create and on update. pve_lxc_reboot_if_required: type: bool default: true description: - Restart the container after its root filesystem was grown. pve_lxc_node: type: str description: - >- Inventory name of the Proxmox host that runs the container. Must be a host in the inventory; its C(ansible_host) is the default of C(pve_lxc_api_host). Not read when C(pve_lxc_manage_lifecycle) is false. pve_lxc_vmid: type: int description: - Container id on the Proxmox node. Not read when C(pve_lxc_manage_lifecycle) is false. pve_lxc_ostemplate: type: str description: - Template volume the container is created from, for example C(local:vztmpl/