-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocp-aicli-cilium-setup.tf
65 lines (57 loc) · 1.98 KB
/
ocp-aicli-cilium-setup.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
60
61
62
63
resource "local_file" "aicli_ocp_config" {
content = templatefile("${path.module}/templates/aicli-ocp-config.yaml", {
ocp_version = var.ocp_version
ocp_base_domain = var.ocp_base_domain
vm_private_network_ipv4_cidr = var.private_network_ipv4_cidr
vm_private_network_ipv6_cidr = var.private_network_ipv6_cidr
})
filename = "${path.module}/tmp/aicli-ocp-config-${var.ocp_cluster_name}.yaml"
}
resource "null_resource" "aicli_cilium_setup" {
depends_on = [local_file.aicli_ocp_config]
connection {
host = var.kvm_host_ip_address
user = var.kvm_host_username
private_key = file(var.path_to_kvm_host_login_ssh_key)
timeout = "5m"
type = "ssh"
}
provisioner "remote-exec" {
inline = ["mkdir -p /aicli/ocp-manifests-dir",
"chmod 777 -R /aicli"]
}
provisioner "file" {
source = var.path_to_ocp_setup_private_key
destination = "/aicli/id_rsa"
}
provisioner "file" {
source = var.path_to_ocp_pull_secret
destination = "/aicli/openshift_pull.json"
}
provisioner "file" {
source = "${path.module}/tmp/aicli-ocp-config-${var.ocp_cluster_name}.yaml"
destination = "/aicli/aicli-ocp-config-${var.ocp_cluster_name}.yaml"
}
provisioner "file" {
source = "${path.module}/scripts/setup-aicli-cilium.sh"
destination = "/aicli/setup-aicli-cilium.sh"
}
provisioner "file" {
source = var.path_to_cilium_config
destination = "/aicli/cluster-network-07-cilium-ciliumconfig.yaml"
}
provisioner "remote-exec" {
inline = [<<EOF
set -o errexit
chmod +x /aicli/setup-aicli-cilium.sh;
export OCP_OFFLINE_TOKEN="${var.ocp_offline_token}";
export OCP_CLUSTER_NAME="${var.ocp_cluster_name}";
export OCP_BASE_DOMAIN="${var.ocp_base_domain}";
export AICLI_VERSION="${var.aicli_version}";
export CILIUM_VERSION="${var.cilium_version}";
/aicli/setup-aicli-cilium.sh;
sleep 1
EOF
]
}
}