summaryrefslogtreecommitdiff
path: root/roles/vm/guest/deploy/tasks/main.yml
blob: aa27b59d6250e117561fc430a684e112149afd06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
- name: fetch infos from image file
  delegate_to: localhost
  stat:
    path: "{{ output_images | first }}"
    get_mime: yes
  register: output_image_info

- name: make sure primary disk image path exists
  delegate_to: "{{ vm_host.name }}"
  file:
    path: "{{ vm_deploy_primary_disk.path | dirname }}"
    state: directory

- name: remove vm if it already exists
  import_role:
    name: vm/guest/remove

  ## TODO: actually call this directly and make file replacement atomic!!
  ##       Probably by writing and action plugin based on this: https://github.com/socratesx/Ansible-Decompress
- name: copy disk image
  pause:
    prompt: |
      Please copy the image to the vm-host i.e. by calling this:

        cat {{ output_image_info.stat.path }} | {{ vm_deploy_decompressors[output_image_info.stat.mimetype] }} | ssh {{ vm_host.name }} 'cat > {{ vm_deploy_primary_disk.path }}'

      When done press ENTER to continue or CTRL-C then A to abort.

- name: create vm
  vars:
    vm_create_installer: no
  import_role:
    name: vm/guest/create