knife-proxmox-ve 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bff2fdcc58a1aeadf186e297e838ddb91510536f7cf0169ccb25a3091c590931
4
- data.tar.gz: 9cdc6b30bfe1a9d8da2feb3f8cf622973dbb0ab553c13c10a3a9729ea444a46a
3
+ metadata.gz: 5d5214d06c2b3094351f1e2824fc0d3e9cceba436f2053bb32001b41fe18ea5c
4
+ data.tar.gz: fad9ae85bb184f7dd8fdb6e54cac5a15a8f9036f1f5f4a07b939cd0a4a0e3f3a
5
5
  SHA512:
6
- metadata.gz: 118d4dd196b869f226c11801b728b4d71661c9aa9756210b3857bf6f629c45515199a9b2e0b9b0f27b07bbf1cee995de81eaa1e1e8102a228d415eae7a94a460
7
- data.tar.gz: b2b0d7b679086f772f7d844c22635c9a749110405362788ece0e7de99a23eec68a97c1e7e18ddfdad30500a5bfb606e8f8ed4b396a61faa9a32a0a1a4f2226ae
6
+ metadata.gz: c4d3a3bdff34585a82c46888572244512f06a7a17b94475b135f2d5f520c2b47d983e07f69cb40baa2ebc2fca8526db2cd5c6c7928ab1f778d2db28061167a05
7
+ data.tar.gz: 9008cdcd204db73879b3f2a4602e202d821dd70b9df217ebc8ff90e59342e7ff805c516497cd7c62970c531fd6f04df7e69f2fac84305836ba1f9faf821f7630
data/README.md CHANGED
@@ -45,12 +45,16 @@ knife[:proxmox_clusters] = {
45
45
  verify_ssl: true, # optional (default true); false warns every run
46
46
 
47
47
  # Optional per-cluster provisioning defaults (any CLI flag overrides these):
48
- storage: "local-lvm",
49
- bridge: "vmbr0",
50
- ciuser: "ubuntu",
51
- nameserver: "10.0.0.1",
52
- searchdomain: "example.com",
53
- target_node: nil,
48
+ storage: "local-lvm",
49
+ bridge: "vmbr0",
50
+ ciuser: "ubuntu",
51
+ ssh_public_key: "~/.ssh/id_ed25519.pub", # default authorized key; satisfies the auth
52
+ # requirement without --ssh-public-key. For
53
+ # `vm bootstrap`, :ciuser also becomes the
54
+ # default --connection-user.
55
+ nameserver: "10.0.0.1",
56
+ searchdomain: "example.com",
57
+ target_node: nil,
54
58
  },
55
59
  }
56
60
 
@@ -150,13 +154,14 @@ Both commands share the provisioning flags below.
150
154
  | `--bridge vmbrN` / `--vlan TAG` | net0 bridge and VLAN tag (needs a VLAN-aware bridge). |
151
155
  | `--ip CIDR\|dhcp` / `--gateway IP` / `--prefix N` | Static IPv4 (`10.0.10.5/24`, or a bare IP with `--prefix`) or `dhcp`. |
152
156
  | `--nameserver IP` / `--searchdomain DOMAIN` | cloud-init DNS. |
153
- | `--ciuser USER` | cloud-init user. |
154
- | `--ssh-public-key PATH` | Public key injected via cloud-init (preferred auth). |
157
+ | `--ciuser USER` | cloud-init user. For `vm bootstrap`, also the default `--connection-user`. |
158
+ | `--ssh-public-key PATH` | Public key injected via cloud-init (preferred auth). Falls back to the cluster's `:ssh_public_key`. |
155
159
  | `--cipassword` | Prompt (no echo) for a cloud-init password; or set `KNIFE_PROXMOX_CIPASSWORD`. |
156
160
  | `--clone-timeout SEC` / `--boot-timeout SEC` | Clone and boot/SSH wait limits (default 600 / 300). |
157
161
 
158
162
  For `vm bootstrap`, the standard `knife bootstrap` options are inherited: `-N/--node-name`,
159
- `-r/--run-list`, `-E/--environment`, `--connection-user`, `--ssh-identity-file`,
163
+ `-r/--run-list`, `-E/--environment`, `--connection-user` (defaults to the resolved `:ciuser`,
164
+ since cloud-init creates the guest account under that name), `--ssh-identity-file`,
160
165
  `--bootstrap-version`, `--ssh-verify-host-key` (defaults to `:accept_new` for the
161
166
  freshly-created host), `--yes`, etc. They do not apply to `vm create`, which never bootstraps.
162
167
 
@@ -110,7 +110,8 @@ class Chef
110
110
 
111
111
  option :ssh_public_key,
112
112
  long: "--ssh-public-key PATH",
113
- description: "Path to an SSH PUBLIC key authorized for the cloud-init user."
113
+ description: "Path to an SSH PUBLIC key authorized for the cloud-init user. " \
114
+ "Defaults to the cluster's :ssh_public_key when set."
114
115
 
115
116
  option :cipassword,
116
117
  long: "--cipassword",
@@ -246,8 +247,8 @@ class Chef
246
247
  return if @ssh_public_key || @cipassword
247
248
 
248
249
  ui.fatal!(
249
- "no SSH credential for the new VM: pass --ssh-public-key PATH, or provide a " \
250
- "cloud-init password via #{ENV_CIPASSWORD} or --cipassword"
250
+ "no SSH credential for the new VM: pass --ssh-public-key PATH (or set the cluster's " \
251
+ ":ssh_public_key), or provide a cloud-init password via #{ENV_CIPASSWORD} or --cipassword"
251
252
  )
252
253
  end
253
254
 
@@ -264,7 +265,7 @@ class Chef
264
265
  # looks like a private key (a common copy-paste mistake that must never be
265
266
  # uploaded as an authorized key).
266
267
  def resolve_ssh_public_key
267
- path = config[:ssh_public_key]
268
+ path = from_cli_or_cluster(:ssh_public_key)
268
269
  return nil if blank?(path)
269
270
 
270
271
  @ssh_public_key_path = File.expand_path(path)
@@ -95,6 +95,11 @@ class Chef
95
95
  def apply_provision_auth!(spec)
96
96
  super
97
97
 
98
+ # cloud-init creates the guest account as :ciuser, so the bootstrap must connect as that
99
+ # same user. Fall back to it when the operator did not pass an explicit --connection-user.
100
+ ciuser = from_cli_or_cluster(:ciuser)
101
+ config[:connection_user] ||= ciuser if ciuser
102
+
98
103
  config[:connection_password] = @cipassword if @cipassword
99
104
 
100
105
  return unless @ssh_public_key
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Knife
4
4
  module Proxmox
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-proxmox-ve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Wojcieszonek