summaryrefslogtreecommitdiff
path: root/roles/cloud/install/tasks/edis-kvm.yml
blob: d51a93056eedf13f00d03fddddd9258c68461bf6 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
# https://documenter.getpostman.com/view/14802249/TzkyNLMQ#intro

  ## TODO: allow other installer variants
- name: generate host specific installer iso
  delegate_to: localhost
  vars:
    installer_base_path: "{{ global_cache_dir }}/debian-installer"
    installer_keyrings_path: "{{ global_files_dir }}/common/keyrings"
  import_role:
    name: installer/debian/iso

- name: upload installer iso to publishing host
  delegate_to: "{{ install.cloud.image_publish.host }}"
  copy:
    src: "{{ iso_install_target_dir }}/{{ install_hostname }}.iso"
    dest: "{{ install.cloud.image_publish.path }}"

- name: generate auth sessions from API
  delegate_to: localhost
  check_mode: no
  uri:
    url: "https://session.edis.at/kvm/v2/get/auth"
    method: POST
    body_format: form-urlencoded
    body:
      email: "{{ install.cloud.credentials.email }}"
      pw: "{{ install.cloud.credentials.password }}"
    status_code: 200
  register: edis_kvm_auth_session_response

- name: make sure server-id is in results
  assert:
    that: install.cloud.id in edis_kvm_auth_session_response.json.data

- name: retrieve auth session for server-id
  set_fact:
    edis_kvm_auth_session: "{{ edis_kvm_auth_session_response.json.data[install.cloud.id] }}"

- debug:
    var: edis_kvm_auth_session

## TODO: actually implement this
##   - @API: download custom iso
##   - @API: power off
##   - @API: mount custom iso
##   - @API: power on
##   - wait for installer to finish (@API get powerstate?)
##   - @API: umount custom iso
##   - @API: power on