Hello everyone,
I am looking for a non-interactive way to set the password for the root user (or any user really) when creating a LXC container from the official Proxmox Ubuntu 16.04 template using pct. For some background: I am currently trying to automate most of my homelab, including LXC container deployment, by using Ansible. This means creating containers through pct instead of through the GUI
I was planning on calling the pct command from an Ansible playbook, which would then create a container, the root storage and adjust all other parameters according to the input I fed the playbook, including the root user password. However, while pct does have a --password parameter, that one asks for password interactively, something that does not play nice with a script. So instead, I am looking for a way to set the password non-interactively, ideally a command-line parameter from pct or something else that can be modified by ansible.
It looks like this used to be possible with OpenVZ containers (blog.droidzone.in/2013/08/13/change-a-containers-root-password-in-proxmox/) , but since those are a thing of the past that command does not do anything, unfortunatley.
For reference, my current pct call looks a little something like this:
Again, I'd like to avoid --password, because doing interactive inputs in a non-interactive script is never pretty. Not setting a password at all does not seem to work either, given that I cannot log in into the LXC container if I remove the --password parameter.
Any help would be highly appreciated!
Cheers!
I am looking for a non-interactive way to set the password for the root user (or any user really) when creating a LXC container from the official Proxmox Ubuntu 16.04 template using pct. For some background: I am currently trying to automate most of my homelab, including LXC container deployment, by using Ansible. This means creating containers through pct instead of through the GUI
I was planning on calling the pct command from an Ansible playbook, which would then create a container, the root storage and adjust all other parameters according to the input I fed the playbook, including the root user password. However, while pct does have a --password parameter, that one asks for password interactively, something that does not play nice with a script. So instead, I am looking for a way to set the password non-interactively, ideally a command-line parameter from pct or something else that can be modified by ansible.
It looks like this used to be possible with OpenVZ containers (blog.droidzone.in/2013/08/13/change-a-containers-root-password-in-proxmox/) , but since those are a thing of the past that command does not do anything, unfortunatley.
For reference, my current pct call looks a little something like this:
Code:
pct create 118 local:vztmpl/ubuntu-16.04-standard_16.04-1_amd64.tar.gz --hostname NewContainer --storage local-lvm --ostype ubuntu --arch amd64 --unprivileged 1 --password
Again, I'd like to avoid --password, because doing interactive inputs in a non-interactive script is never pretty. Not setting a password at all does not seem to work either, given that I cannot log in into the LXC container if I remove the --password parameter.
Any help would be highly appreciated!
Cheers!