Update
This commit is contained in:
6
07-remote-install-docker/README.md
Normal file
6
07-remote-install-docker/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
%title: Terraform
|
||||
%author: hubert
|
||||
|
||||
# Terraform : remote_exec - Installation docker & socket
|
||||
|
||||
<br>
|
40
07-remote-install-docker/main.tf
Normal file
40
07-remote-install-docker/main.tf
Normal file
@ -0,0 +1,40 @@
|
||||
variable "ssh_host" {}
|
||||
variable "ssh_user" {}
|
||||
variable "ssh_key" {}
|
||||
resource "null_resource" "ssh_target" {
|
||||
connection {
|
||||
type = "ssh"
|
||||
user = var.ssh_user
|
||||
host = var.ssh_host
|
||||
private_key = file(var.ssh_key)
|
||||
}
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"sudo apt update -qq >/dev/null",
|
||||
"curl -fsSL https://get.docker.com -o get-docker.sh",
|
||||
"sudo chmod 755 get-docker.sh",
|
||||
"sudo ./get-docker.sh >/dev/null"
|
||||
]
|
||||
}
|
||||
provisioner "file" {
|
||||
source = "startup-options.conf"
|
||||
destination = "/tmp/startup-options.conf"
|
||||
}
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"sudo mkdir -p /etc/systemd/system/docker.service.d/",
|
||||
"sudo cp /tmp/startup-options.conf /etc/systemd/system/docker.service.d/startup_options.conf",
|
||||
"sudo systemctl daemon-reload",
|
||||
"sudo systemctl restart docker",
|
||||
"sudo usermod -aG docker vagrant"
|
||||
]
|
||||
}
|
||||
}
|
||||
output "host" {
|
||||
value = var.ssh_host
|
||||
}
|
||||
output "user" {
|
||||
value = var.ssh_user
|
||||
}
|
||||
|
||||
|
3
07-remote-install-docker/startup-options.conf
Normal file
3
07-remote-install-docker/startup-options.conf
Normal file
@ -0,0 +1,3 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/dockerd -H tcp://10.0.4.103:2375 -H unix:///var/run/docker.sock
|
Reference in New Issue
Block a user