Advertisement
PandaAcademy

ansible.tf

Jul 27th, 2022
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. resource "null_resource" "download_ssh_key" {
  2. triggers = {
  3. timestamp = "${replace("${timestamp()}", "/[-| |T|Z|:]/", "")}"
  4. }
  5.  
  6. provisioner "local-exec" {
  7. command = "mkdir -p ~/.ssh/ && aws s3 cp s3://${var.bucket_name}/panda_kurs.pem ~/.ssh/panda_kurs.pem || true && chmod 400 ~/.ssh/panda_kurs.pem"
  8. }
  9. }
  10.  
  11. resource "local_file" "ansible_inventory" {
  12. content = templatefile("inventory.tpl",
  13. { ansible_ip = "${join("\n", aws_instance.panda.*.public_ip)}" })
  14. filename = "${path.module}/../inventory"
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement