- name: Add ec2 host to inventory add_host: name: "{{ terraform_output.outputs.public_ip.value }}" ansible_ssh_private_key_file: "{{ ssh_pem }}" ansible_user: "{{ ssh_user }}" groups: ec2hosts