From 85f91135e58106b838083bd8a96734be6abafad1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 18:38:37 +0100 Subject: make vm install work for both debian/ubuntu and openbsd --- common/vm-install.yml | 21 ++++++++++++--------- roles/vm/install/meta/main.yml | 7 ------- roles/vm/install/tasks/main.yml | 22 ++++++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 roles/vm/install/meta/main.yml diff --git a/common/vm-install.yml b/common/vm-install.yml index 02c95fd8..cb3b86f0 100644 --- a/common/vm-install.yml +++ b/common/vm-install.yml @@ -45,15 +45,18 @@ set_fact: ansible_ssh_extra_args: "" -# - name: apply basic VM configuration roles -# hosts: "{{ hostname }}" -# pre_tasks: -# - name: make sure to update cached facts -# setup: -# roles: -# - role: vm/grub -# - role: vm/network -# - role: vm/guest +- name: apply basic VM configuration roles + hosts: "{{ hostname }}" + pre_tasks: + - name: make sure to update cached facts + setup: + roles: + - role: vm/grub + when: install_distro in ['debian', 'ubuntu'] + - role: vm/network + when: install_distro in ['debian', 'ubuntu'] + - role: vm/guest + when: install_distro in ['debian', 'ubuntu'] - import_playbook: "../{{ hostenv }}/{{ hostname }}.yml" diff --git a/roles/vm/install/meta/main.yml b/roles/vm/install/meta/main.yml deleted file mode 100644 index 34c068b6..00000000 --- a/roles/vm/install/meta/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# dependencies: -# - role: installer/debian/base -# distros: -# - distro: "{{ install_distro }}" -# codename: "{{ install_codename }}" -# arch: [ "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" ] diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index bc31967a..20484401 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -28,22 +28,24 @@ state: directory register: tmpdir - # - import_role: - # name: installer/debian/preseed - # vars: - # ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" - # preseed_tmpdir: "{{ tmpdir.path }}" - # preseed_force_net_ifnames_policy: path - # preseed_no_netplan: yes - # install_interface: enp1s1 + - when: install_distro in ['debian', 'ubuntu'] + vars: + ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + preseed_tmpdir: "{{ tmpdir.path }}" + preseed_force_net_ifnames_policy: path + preseed_no_netplan: yes + install_interface: enp1s1 + import_role: + name: installer/debian/preseed - - import_role: - name: installer/openbsd/autoinstall + - when: install_distro in ['openbsd'] vars: ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" obsd_autoinstall_tmpdir: "{{ tmpdir.path }}" obsd_autoinstall_serial_device: com0 install_interface: vio0 + import_role: + name: installer/openbsd/autoinstall - name: Make installer workdir readable by qemu acl: -- cgit v1.2.3