This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_daemon.tf
59 lines (51 loc) · 1.58 KB
/
docker_daemon.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
data "template_file" "docker_daemon_json" {
template = file("${path.module}/templates/docker-daemon.json.tpl")
vars = {
public_ip = oci_core_instance.ampere_a1.0.public_ip
}
}
output "docker_daemon_json" {
value = data.template_file.docker_daemon_json.rendered
}
resource "local_file" "docker_daemon_json" {
content = data.template_file.docker_daemon_json.rendered
filename = "${path.module}/docker_registry-daemon.json"
}
data "template_file" "awx_build_sh" {
template = file("${path.module}/templates/awx_build.sh.tpl")
vars = {
public_ip = oci_core_instance.ampere_a1.0.public_ip
awx_build_prefix = var.awx_build_prefix
awx_version = var.awx_version
awx_operator_version = var.awx_operator_version
}
}
output "awx_build_sh" {
value = data.template_file.awx_build_sh.rendered
}
resource "null_resource" "configure_docker" {
triggers = {
instance_public_ip = oci_core_instance.ampere_a1.0.public_ip
template_content = data.template_file.docker_daemon_json.rendered
}
connection {
type = "ssh"
host = oci_core_instance.ampere_a1.0.public_ip
user = "opc"
private_key = tls_private_key.oci.private_key_pem
}
provisioner "file" {
content = data.template_file.docker_daemon_json.rendered
destination = "/home/opc/daemon.json"
}
provisioner "file" {
content = data.template_file.awx_build_sh.rendered
destination = "/home/opc/awx_build.sh"
}
provisioner "remote-exec" {
inline = [
"sudo cp /home/opc/awx_build.sh /opt/awx_build.sh",
"sudo chmod 0777 /opt/awx_build.sh",
]
}
}