/
Terraform call a Ansible script
Terraform call a Ansible script
1- create an Ansible yml playbook
2- Create in the terraform an "local-exec" provider to log into the VM and run the Ansible Playbook
https://getintodevops.com/blog/using-ansible-with-terraform
# This is where we configure the instance with ansible-playbook
provisioner "local-exec" {
command = "sleep 120; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u ubuntu --private-key ./deployer.pem -i '${aws_instance.jenkins_master.public_ip},' master.yml"
}
https://alex.dzyoba.com/blog/terraform-ansible/
provisioner "local-exec" { command = "ansible-playbook -i '${self.public_ip},' --private-key ${var.ssh_key_private} provision.yml" }
provisioner "local-exec" {
command = "ansible-playbook -u fedora -i '${self.public_ip},' --private-key ${var.ssh_key_private} provision.yml"
}
, multiple selections available,
Related content
Terraform single vSRX and one Ubuntu instance on AWS
Terraform single vSRX and one Ubuntu instance on AWS
More like this
Terraform Main page
Terraform Main page
More like this
output public ip address from terraform
output public ip address from terraform
More like this
automated installation of contrail 5 with ansible
automated installation of contrail 5 with ansible
More like this
Create: VPC, 1x instance of vSRX with Elastic IP@
Create: VPC, 1x instance of vSRX with Elastic IP@
More like this
aws provider: the right way
aws provider: the right way
More like this