Skip to content

Commit 2f10e7a

Browse files
committed
New: add settings to create LXC with ssh-public-keys
1 parent c368075 commit 2f10e7a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/vagrant-proxmox/action/create_vm.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def create_params_lxc(config, env, vm_id)
103103
tty: config.lxc_tty,
104104
pool: config.pool
105105
}.tap do |params|
106+
params['ssh-public-keys'] = config.lxc_ssh_public_keys
106107
params[:nameserver] = config.lxc_nameserver.to_s\
107108
if config.lxc_nameserver
108109
params[:onboot] = get_rest_boolean(config.lxc_onboot)

lib/vagrant-proxmox/config.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ class Config < Vagrant.plugin('2', :config)
301301
# @return [Boolean]
302302
attr_accessor :use_plain_description
303303

304+
# LXC ssh-public-keys
305+
# Setup public SSH keys (one key per line, OpenSSH format).
306+
#
307+
# @return [String]
308+
attr_accessor :lxc_ssh_public_keys
309+
304310
def initialize
305311
@endpoint = UNSET_VALUE
306312
@selected_node = UNSET_VALUE
@@ -356,6 +362,7 @@ def initialize
356362
@dry = false
357363
@description = UNSET_VALUE
358364
@use_plain_description = false
365+
@lxc_ssh_public_keys = UNSET_VALUE
359366
end
360367

361368
# This is the hook that is called to finalize the object before it is put into use.
@@ -381,6 +388,7 @@ def finalize!
381388
@lxc_tty = 2 if @lxc_tty == UNSET_VALUE
382389
@pool = 'all' if @pool == UNSET_VALUE
383390
@description = '' if @description == UNSET_VALUE
391+
@lxc_ssh_public_keys = '' if @lxc_ssh_public_keys == UNSET_VALUE
384392
end
385393

386394
def validate(_machine)

0 commit comments

Comments
 (0)