Terraform: Terraform doesn't output colour with Ansible in local-exec

Created on 2 Jun 2019  ยท  4Comments  ยท  Source: hashicorp/terraform

Current Terraform Version

v0.11.13

Use-cases

Currently its very hard to read ansible output when provisioning within terraform because all the colours are removed. This also makes it difficult to detect warnings and errors at times.

Proposal

It would be great to enable ansible output colour in the shell by default when being used in a local or remote exec.

enhancement provisionelocal-exec

Most helpful comment

My workaround was to use ANSIBLE_FORCE_COLOR=1

provisioner "local-exec" {
    command = "ANSIBLE_FORCE_COLOR=1 ansible-playbook --ssh-extra-args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' -u ${var.ssh_user} --private-key ${var.shared_key_path} -i ansible/inventory ansible/playbook.yml"
  }

All 4 comments

Is it possible to achieve any workaround for this ability?

My workaround was to use ANSIBLE_FORCE_COLOR=1

provisioner "local-exec" {
    command = "ANSIBLE_FORCE_COLOR=1 ansible-playbook --ssh-extra-args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' -u ${var.ssh_user} --private-key ${var.shared_key_path} -i ansible/inventory ansible/playbook.yml"
  }

Fantastic! Thanks @nickkadams!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings