hostname works
This commit is contained in:
parent
d4782d00cc
commit
9d43c19189
3 changed files with 25 additions and 24 deletions
|
|
@ -78,15 +78,14 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
ssh_keys_list: "{{ ssh_key_content.content | b64decode | split('\n') | select('match', '^ssh-') | list }}"
|
ssh_keys_list: "{{ ssh_key_content.content | b64decode | split('\n') | select('match', '^ssh-') | list }}"
|
||||||
|
|
||||||
- name: Write cloud-init user-data snippet to install qemu-guest-agent
|
- name: Write cloud-init vendor-data snippet to install qemu-guest-agent
|
||||||
copy:
|
copy:
|
||||||
dest: "{{ zfs_pool_mountpoint }}/snippets/{{ qemu_agent_snippet_filename }}"
|
dest: "{{ zfs_pool_mountpoint }}/snippets/{{ qemu_agent_snippet_filename }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
content: |
|
content: |
|
||||||
#cloud-config
|
#cloud-config
|
||||||
user: {{ proxmox_ciuser }}
|
# Vendor-data snippet: Proxmox will automatically set hostname from VM name when using vendor-data
|
||||||
ssh_authorized_keys:
|
# User info (ciuser/sshkeys) is set separately via Terraform/Proxmox parameters
|
||||||
{{ ssh_keys_list | to_nice_yaml | indent(10, first=True) }}
|
|
||||||
package_update: true
|
package_update: true
|
||||||
package_upgrade: true
|
package_upgrade: true
|
||||||
packages:
|
packages:
|
||||||
|
|
@ -164,7 +163,7 @@
|
||||||
]
|
]
|
||||||
+ (proxmox_ci_upgrade | bool
|
+ (proxmox_ci_upgrade | bool
|
||||||
| ternary(['--ciupgrade 1'], []))
|
| ternary(['--ciupgrade 1'], []))
|
||||||
+ ['--cicustom user=local:snippets/' ~ qemu_agent_snippet_filename]
|
+ ['--cicustom vendor=local:snippets/' ~ qemu_agent_snippet_filename]
|
||||||
}}
|
}}
|
||||||
when:
|
when:
|
||||||
- vmid_config_check.rc != 0 or not vm_already_template | default(false) or ide2_removed.changed | default(false)
|
- vmid_config_check.rc != 0 or not vm_already_template | default(false) or ide2_removed.changed | default(false)
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,13 @@ resource "proxmox_vm_qemu" "vm" {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cloud-init: user, ssh keys, IP, and custom snippet for qemu-guest-agent
|
# Cloud-init: user, ssh keys, IP, and custom snippet for qemu-guest-agent
|
||||||
# Note: Using 'local' storage for snippets (not ZFS) as ZFS storage doesn't properly support snippet paths
|
# Note: Using vendor-data snippet (instead of user-data) allows Proxmox to automatically
|
||||||
|
# set the hostname from the VM name. User info is set separately via ciuser/sshkeys.
|
||||||
|
# Using 'local' storage for snippets (not ZFS) as ZFS storage doesn't properly support snippet paths
|
||||||
ciuser = var.cloud_init_user
|
ciuser = var.cloud_init_user
|
||||||
sshkeys = var.ssh_authorized_keys
|
sshkeys = var.ssh_authorized_keys
|
||||||
ipconfig0 = try(each.value.ipconfig0, local.default_ipconfig0)
|
ipconfig0 = try(each.value.ipconfig0, local.default_ipconfig0)
|
||||||
cicustom = "user=local:snippets/user-data-qemu-agent.yaml"
|
cicustom = "vendor=local:snippets/user-data-qemu-agent.yaml"
|
||||||
|
|
||||||
# Disk on ZFS storage
|
# Disk on ZFS storage
|
||||||
disk {
|
disk {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue