August 2019
Beginner
608 pages
16h 7m
English
We are going to use the Terraform Ansible provider to translate a Terraform state file into a dynamic Ansible inventory. We are going to create resources of the ansible_host type, which are taken care of by the Ansible provider. As an example, the host that defines our frontend application server is as follows:
resource "ansible_host" "FRONTEND001" { inventory_hostname = "${aws_instance.FRONTEND_A.private_dns}" groups = ["frontend"] vars { ansible_user = "ubuntu" role = "master" ansible_ssh_private_key_file="/tmp/mykey.pem" ansible_python_interpreter="/usr/bin/python3" ansible_ssh_common_args= " -o ProxyCommand=\"ssh -o StrictHostKeyChecking=no -i /tmp/mykey.pem -W %h:%p -q ubuntu@${aws_instance.BASTIONHOST_A.public_dns}\"" ...Read now
Unlock full access