89luca89/terrible

Add VM-resource reload when changing the terraform file

Closed this issue · 1 comments

This should be useful for adding/removing ifaces and passtrought in future.

Add

- name: "Terraform renew target VMs"
  terraform:
    project_path: "{{ hcl_deploy_path }}/{{ inventory_hostname }}"
    force_init: true
    state: absent
    targets: "libvirt_domain.domain-terraform"
  tags: deploy, apply, generate_hcl
  when: terraform_status.changed
  delegate_to: terraform_node

We could think to change the destroy tag behavior, splitting this in an updated tag destroy and another tag purge.
The destroy tag will destroy the vm, not the resources (additional disks, interfaces, etc).
The purge tag will destroy the entire vm with the whole resources.