feat: disable root user & bootstrap ansible user at VM provisioning with cloud-init
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
[dokploy]
|
[dokploy]
|
||||||
dokploy ansible_host=${public_ip} ansible_user=root
|
dokploy ansible_host=${public_ip}
|
||||||
|
|||||||
+3
-1
@@ -10,7 +10,9 @@ resource "hcloud_server" "dokploy" {
|
|||||||
image = var.hcloud_image
|
image = var.hcloud_image
|
||||||
server_type = var.hcloud_server_type
|
server_type = var.hcloud_server_type
|
||||||
location = var.hcloud_location
|
location = var.hcloud_location
|
||||||
ssh_keys = [hcloud_ssh_key.ansible.id]
|
user_data = templatefile("${path.module}/user_data.tpl", {
|
||||||
|
ssh_public_key = var.ssh_public_key
|
||||||
|
})
|
||||||
firewall_ids = [hcloud_firewall.host.id]
|
firewall_ids = [hcloud_firewall.host.id]
|
||||||
|
|
||||||
public_net {
|
public_net {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# cloud-config
|
||||||
|
users:
|
||||||
|
- name: ansible
|
||||||
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
|
shell: /bin/bash
|
||||||
|
ssh_authorized_keys:
|
||||||
|
- ${ssh_public_key}
|
||||||
|
ssh_pwauth: false
|
||||||
|
disable_root: true
|
||||||
Reference in New Issue
Block a user