Skip to content

Commit

Permalink
Improve template formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
89luca89 committed Apr 9, 2021
1 parent 3cd14c9 commit 77274cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.yml linguist-detectable=true
*.md linguist-detectable=true
13 changes: 9 additions & 4 deletions roles/terrible/templates/terraform-vm.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,15 @@ resource "libvirt_domain" "domain_{{ inventory_hostname }}" {
port = "{{ ssh_port }}"

{% if terraform_bastion_enabled %}
{% if terraform_bastion_host != 'localhost' and terraform_bastion_host != '127.0.0.1' %}
bastion_host = "{{ terraform_bastion_host }}"
bastion_port = "{{ terraform_bastion_port }}"
bastion_user = "{{ terraform_bastion_user }}"
bastion_password = "{{ terraform_bastion_password }}"
{% if ansible_ssh_private_key_file is defined %}
bastion_private_key = "${file("{{ ansible_ssh_private_key_file }}")}"
{% endif %}
{% endif %}
{% endif %}
}
# Hostdev passtrought
Expand Down Expand Up @@ -177,9 +182,9 @@ resource "libvirt_domain" "domain_{{ inventory_hostname }}" {
provisioner "remote-exec" {
inline = [
{% for pkg in ansible_dependencies %}
{% if not 'None' in pkg %}
{% if not 'None' in pkg %}
"{{ install_command }} {{ pkg }}"{% if not loop.last %},{% endif %}
{% endif %}
{% endif %}

{% endfor %}
]
Expand All @@ -190,9 +195,9 @@ resource "libvirt_domain" "domain_{{ inventory_hostname }}" {
provisioner "remote-exec" {
when = destroy
inline = [
{% for provisioner_command in terraform_destroy_provisioners %}
{% for provisioner_command in terraform_destroy_provisioners %}
"{{ provisioner_command }}"{% if not loop.last %},{% endif %}
{% endfor %}
{% endfor %}
]
}
{% endif %}
Expand Down

0 comments on commit 77274cf

Please sign in to comment.