Skip to content
Snippets Groups Projects
Commit 08c0a0cd authored by Nathan Rodet's avatar Nathan Rodet
Browse files

Replace Remote Exec to cloud-init files

parent 50eaf220
No related branches found
No related tags found
6 merge requests!6End of development,!5Develop,!4End of development,!3Develop,!2hot-fix: change readme.md,!1Develop
Pipeline #49032 passed
#cloud-config
package_update: true
package_upgrade: true
runcmd:
- "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
- "source \"$HOME/.cargo/env\""
......@@ -82,42 +82,47 @@ resource "scaleway_instance_server" "user_instance_server" {
ip_id = scaleway_instance_ip.public_ip[count.index].id
security_group_id = scaleway_instance_security_group.www.id
user_data = {
foo = "bar"
cloud-init = file("../instance_scripts/cloud-init.yml")
}
depends_on = [
scaleway_account_ssh_key.ssh_key,
scaleway_instance_security_group.www
]
}
resource "null_resource" "provisioner" {
count = var.INSTANCES_COUNT
depends_on = [
scaleway_instance_server.user_instance_server
]
connection {
host = element(scaleway_instance_ip.public_ip.*.address, count.index)
type = "ssh"
user = "root"
private_key = var.SCW_SSH_PRIVATE_KEY
timeout = "2m"
}
// Install Rust
provisioner "remote-exec" {
inline = [
"apt-get update -y'",
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'",
"source \"$HOME/.cargo/env\"",
]
}
// Install Code-server
provisioner "remote-exec" {
inline = [
"curl -fsSL https://code-server.dev/install.sh | sh",
"mkdir -p /root/.config/code-server/",
"echo 'bind-addr: 0.0.0.0:8080\nauth: password\npassword: yfB4W23G\ncert: false\n' > /root/.config/code-server/config.yaml",
"systemctl enable --now code-server@$USER"
]
}
}
\ No newline at end of file
#resource "null_resource" "provisioner" {
# count = var.INSTANCES_COUNT
# depends_on = [
# scaleway_instance_server.user_instance_server
# ]
#
# connection {
# host = element(scaleway_instance_ip.public_ip.*.address, count.index)
# type = "ssh"
# user = "root"
# private_key = var.SCW_SSH_PRIVATE_KEY
# timeout = "2m"
# }
#
# // Install Rust
# provisioner "remote-exec" {
# inline = [
# "apt-get update -y'",
# "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'",
# "source \"$HOME/.cargo/env\"",
# ]
# }
#
# // Install Code-server
# provisioner "remote-exec" {
# inline = [
# "curl -fsSL https://code-server.dev/install.sh | sh",
# "mkdir -p /root/.config/code-server/",
# "echo 'bind-addr: 0.0.0.0:8080\nauth: password\npassword: yfB4W23G\ncert: false\n' > /root/.config/code-server/config.yaml",
# "systemctl enable --now code-server@$USER"
# ]
# }
#}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment