From 56aa88c7e272ccfd645695103d5bca653005aad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Tue, 7 Dec 2021 21:42:58 +0000 Subject: roles/vmm: Use host kernels for openbsd guests --- roles/vmm/tasks/autoinstall-configuration.yml | 27 ---------------- roles/vmm/tasks/autoinstall_configuration.yml | 45 +++++++++++++++++++++++++++ roles/vmm/tasks/facts.yml | 8 ++--- roles/vmm/tasks/main.yml | 2 +- 4 files changed, 50 insertions(+), 32 deletions(-) delete mode 100644 roles/vmm/tasks/autoinstall-configuration.yml create mode 100644 roles/vmm/tasks/autoinstall_configuration.yml (limited to 'roles/vmm/tasks') diff --git a/roles/vmm/tasks/autoinstall-configuration.yml b/roles/vmm/tasks/autoinstall-configuration.yml deleted file mode 100644 index e05b11c..0000000 --- a/roles/vmm/tasks/autoinstall-configuration.yml +++ /dev/null @@ -1,27 +0,0 @@ -- name: include httpd role variables - include_vars: "{{ inventory_dir }}/roles/httpd/defaults/main.yml" - -- name: create autoinstall directory - file: - path: /var/www/htdocs/autoinstall - owner: www - group: www - mode: 0700 - state: directory - -- name: generate autoinstall files - template: - src: autoinstall.conf.j2 - dest: "/var/www/htdocs/autoinstall/{{ item.lladdr }}-install.conf" - owner: www - group: www - mode: 0640 - loop: "{{ vmm_vms }}" - -- name: generate httpd configuration - template: - src: httpd.conf.j2 - dest: "{{ httpd_configuration_dir }}/autoinstall.conf" - owner: 0 - group: 0 - mode: 0640 diff --git a/roles/vmm/tasks/autoinstall_configuration.yml b/roles/vmm/tasks/autoinstall_configuration.yml new file mode 100644 index 0000000..cd52a84 --- /dev/null +++ b/roles/vmm/tasks/autoinstall_configuration.yml @@ -0,0 +1,45 @@ +- name: include httpd role variables + include_vars: "{{ inventory_dir }}/roles/httpd/defaults/main.yml" + +- name: create autoinstall directory + file: + path: /var/www/htdocs/autoinstall + owner: www + group: www + mode: 0700 + state: directory + +- name: generate autoinstall files + template: &generation_steps + src: autoinstall.conf.j2 + dest: "/var/www/htdocs/autoinstall/{{ item.lladdr }}-install.conf" + owner: www + group: www + mode: 0640 + when: item.image == "openbsd" + loop: "{{ vmm_vms }}" + +- name: generate autoupgrade files + template: + <<: *generation_steps + dest: "/var/www/htdocs/autoinstall/{{ item.lladdr }}-upgrade.conf" + when: item.image == "openbsd" + loop: "{{ vmm_vms }}" + +- name: generate httpd configuration + template: + <<: *generation_steps + src: httpd.conf.j2 + dest: "{{ httpd_configuration_dir }}/autoinstall.conf" + owner: 0 + group: 0 + +- name: link openbsd vm kernel to host kernel + file: + src: /bsd.sp + dest: "{{ vmm_image_openbsd_kernel_prefix }}.{{ item.name }}" + owner: 0 + group: 0 + state: hard + when: item.image == "openbsd" + loop: "{{ vmm_vms }}" diff --git a/roles/vmm/tasks/facts.yml b/roles/vmm/tasks/facts.yml index c7b453b..58a6df5 100644 --- a/roles/vmm/tasks/facts.yml +++ b/roles/vmm/tasks/facts.yml @@ -2,10 +2,10 @@ set_fact: vmm_vms_tmp: > {{ vmm_vms_tmp | default([]) + [ item | combine({ - 'lladdr': item.name - | hash('sha1') - | truncate(12, True, '') - | ansible.netcommon.hwaddr('unix') + "lladdr": item.name + | hash("sha1") + | truncate(12, True, "") + | ansible.netcommon.hwaddr("unix") }) ] }} loop: "{{ vmm_vms }}" diff --git a/roles/vmm/tasks/main.yml b/roles/vmm/tasks/main.yml index c596664..26580f2 100644 --- a/roles/vmm/tasks/main.yml +++ b/roles/vmm/tasks/main.yml @@ -14,7 +14,7 @@ include_tasks: facts.yml - name: include autoinstall generation - include_tasks: autoinstall-configuration.yml + include_tasks: autoinstall_configuration.yml tags: task_autoinstall_configuration - name: include iso management -- cgit v1.2.3