1- create an Ansible yml playbook
...
# 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"
}