Created
June 7, 2021 13:25
-
-
Save yogesh174/ed249bab2beb88948b79e87ccd995c6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
######## Configure instances using ansible ######## | |
################################################### | |
resource "null_resource" "configure_aws_k8s_master" { | |
depends_on = [aws_instance.k8s_master, ansible_host.aws_k8s_master] | |
provisioner "local-exec" { | |
command = "ansible-playbook ansible/aws/configure-k8s-master.yaml -i ansible-inventory" | |
} | |
} | |
resource "null_resource" "configure_aws_k8s_worker" { | |
depends_on = [null_resource.configure_aws_k8s_master, aws_instance.k8s_worker, ansible_group.aws_k8s_nodes] # , ansible_host.aws_k8s_node | |
triggers = { | |
cluster_instance_ids = join(", ", aws_instance.k8s_worker.*.id) | |
} | |
provisioner "local-exec" { | |
command = "ansible-playbook ansible/aws/configure-k8s-worker.yaml -i ansible-inventory" | |
} | |
} | |
resource "null_resource" "configure_gcp_k8s_worker" { | |
depends_on = [null_resource.configure_aws_k8s_master, google_compute_instance.k8s_worker, ansible_group.gcp_k8s_nodes] | |
triggers = { | |
cluster_instance_ids = join(", ", google_compute_instance.k8s_worker.*.id) | |
} | |
provisioner "local-exec" { | |
command = "ansible-playbook ansible/gcp/configure-k8s-worker.yaml -i ansible-inventory" | |
} | |
} | |
resource "null_resource" "configure_azure_k8s_worker" { | |
depends_on = [null_resource.configure_aws_k8s_master, azurerm_linux_virtual_machine.k8s_worker, ansible_group.azure_k8s_nodes] | |
triggers = { | |
cluster_instance_ids = join(", ", azurerm_linux_virtual_machine.k8s_worker.*.id) | |
} | |
provisioner "local-exec" { | |
command = "ansible-playbook ansible/azure/configure-k8s-worker.yaml -i ansible-inventory" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment