move users.yaml into main.tf
This commit is contained in:
parent
df40793c12
commit
6441943c82
2 changed files with 13 additions and 8 deletions
|
@ -36,7 +36,18 @@ resource "yandex_compute_instance" "vm" {
|
||||||
memory = 2
|
memory = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata = { user-data = "${file("users.yml")}" }
|
metadata = {
|
||||||
|
user-data = yamlencode({
|
||||||
|
users = [{
|
||||||
|
name = "andrei"
|
||||||
|
shell = "/bin/bash"
|
||||||
|
sudo = "ALL=(ALL) NOPASSWD:ALL"
|
||||||
|
ssh-authorized-keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEt0hgwAMTEZNNQXn91s2dEj1R+jRR16qYQNZxZiAzD/ andrei@debian"
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "yandex_vpc_network" "network1" {
|
resource "yandex_vpc_network" "network1" {
|
||||||
|
@ -93,3 +104,4 @@ resource "ansible_host" "vm" {
|
||||||
ansible_host = yandex_compute_instance.vm[count.index].network_interface.0.nat_ip_address
|
ansible_host = yandex_compute_instance.vm[count.index].network_interface.0.nat_ip_address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#cloud-config
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#cloud-config
|
|
||||||
users:
|
|
||||||
- name: andrei
|
|
||||||
shell: /bin/bash
|
|
||||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
||||||
ssh-authorized-keys:
|
|
||||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEt0hgwAMTEZNNQXn91s2dEj1R+jRR16qYQNZxZiAzD/ andrei@debian
|
|
Loading…
Add table
Add a link
Reference in a new issue