From 896ad17857f0a67ef96c1c4680af91698bc2c5d4 Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Tue, 1 Oct 2024 23:45:26 +0200 Subject: [PATCH 1/5] domain-template: fix cpu model --- vagrant/ansible/roles/vm/templates/domain-template.xml.j2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vagrant/ansible/roles/vm/templates/domain-template.xml.j2 b/vagrant/ansible/roles/vm/templates/domain-template.xml.j2 index 15ad8479..c33af7cc 100644 --- a/vagrant/ansible/roles/vm/templates/domain-template.xml.j2 +++ b/vagrant/ansible/roles/vm/templates/domain-template.xml.j2 @@ -17,8 +17,9 @@ - - + + core2duo + From b15016988f2fe91c7cbff808f08dbce06cc52ad3 Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Tue, 1 Oct 2024 23:46:07 +0200 Subject: [PATCH 2/5] vm: install packer 1.6.0 from zip archive --- vagrant/ansible/roles/vm/tasks/main.yml | 77 ++++++++++++++++++------- 1 file changed, 57 insertions(+), 20 deletions(-) diff --git a/vagrant/ansible/roles/vm/tasks/main.yml b/vagrant/ansible/roles/vm/tasks/main.yml index f335f884..a6f3c90c 100644 --- a/vagrant/ansible/roles/vm/tasks/main.yml +++ b/vagrant/ansible/roles/vm/tasks/main.yml @@ -12,12 +12,44 @@ group: vagrant - name: setup libvirt - include: libvirt.yml + include_tasks: libvirt.yml -- name: install Packer - apt: - name: packer +- name: Create temporary directory + ansible.builtin.tempfile: + state: directory + suffix: packer + register: temp_dir + +- name: Download Packer zip archive + ansible.builtin.get_url: + url: "https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip" + dest: "{{ temp_dir.path }}/packer.zip" + mode: "0644" + +- name: Install unzip + ansible.builtin.apt: + name: unzip state: present + become: true + +- name: Unzip Packer archive + ansible.builtin.unarchive: + src: "{{ temp_dir.path }}/packer.zip" + dest: "{{ temp_dir.path }}" + remote_src: true + +- name: Move Packer binary to /usr/local/bin + ansible.builtin.copy: + src: "{{ temp_dir.path }}/packer" + dest: "/usr/local/bin/packer" + mode: "0755" + remote_src: true + become: true + +- name: Clean up temporary directory + ansible.builtin.file: + path: "{{ temp_dir.path }}" + state: absent - name: upload templates synchronize: @@ -33,35 +65,40 @@ mode: 0666 - name: setup Windows XP - include: setup.yml + include_tasks: setup.yml with_items: - { - name: 'winxp', - ram: '512', - packer_template: 'windows.json', - packer_varfile: 'winxp.json', - image_url: 'https://www.dropbox.com/s/0zycew5u3xnf8m7/winxp.qcow2?dl=1', - checksum_url: 'sha1:8550675150ee1601859c4665d49eb29005065446' + name: "winxp", + ram: "512", + packer_template: "windows.json", + packer_varfile: "winxp.json", + image_url: "https://www.dropbox.com/s/0zycew5u3xnf8m7/winxp.qcow2?dl=1", + checksum_url: "sha1:8550675150ee1601859c4665d49eb29005065446", } when: enabled_vms['winxp'] - name: setup Windows 7 - include: setup.yml + include_tasks: setup.yml with_items: - { - name: 'win7', - ram: '1500', - packer_template: 'windows.json', - packer_varfile: 'win7.json', - image_url: 'https://www.dropbox.com/s/x9uyexfbhumphe7/win7.qcow2?dl=1', - checksum_url: 'sha1:64c1c051efa70c902b0fd4b10c7d8da90215bbca' + name: "win7", + ram: "1500", + packer_template: "windows.json", + packer_varfile: "win7.json", + image_url: "https://www.dropbox.com/s/x9uyexfbhumphe7/win7.qcow2?dl=1", + checksum_url: "sha1:64c1c051efa70c902b0fd4b10c7d8da90215bbca", } when: enabled_vms['win7'] - name: setup Ubuntu - include: setup.yml + include_tasks: setup.yml with_items: - - { name: 'ubuntu', ram: '1024', packer_template: 'ubuntu.json', packer_varfile: 'ubuntu-16.04-server-i386.json' } + - { + name: "ubuntu", + ram: "1024", + packer_template: "ubuntu.json", + packer_varfile: "ubuntu-16.04-server-i386.json", + } when: enabled_vms['ubuntu'] - name: refresh libvirt pool From d01d2bff2400b28aec2bd84ba28609394806d3fd Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Tue, 1 Oct 2024 23:46:51 +0200 Subject: [PATCH 3/5] kvm: install dwarves --- vagrant/ansible/roles/kvm/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vagrant/ansible/roles/kvm/tasks/main.yml b/vagrant/ansible/roles/kvm/tasks/main.yml index 04a1379e..09f7a0df 100644 --- a/vagrant/ansible/roles/kvm/tasks/main.yml +++ b/vagrant/ansible/roles/kvm/tasks/main.yml @@ -14,7 +14,7 @@ - bison - libelf-dev - libssl-dev - - pahole + - dwarves # because of Windows filesystem restrictions, the KVM repo cannot be checked out on Windows # it contains some files like @@ -76,11 +76,11 @@ become: false - name: install kvm - include: install_deb.yml + include_tasks: install_deb.yml when: kvm_install_package - name: install kvm - include: install_normal.yml + include_tasks: install_normal.yml when: not kvm_install_package - name: set kvmi kernel as default @@ -93,4 +93,4 @@ command: update-grub - name: setup libkvmi - include: libkvmi.yml + include_tasks: libkvmi.yml From 455928459d4108c2c52ce24b831928157622fdfa Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Tue, 1 Oct 2024 23:47:04 +0200 Subject: [PATCH 4/5] kvm: remove extra cflags --- vagrant/ansible/roles/kvm/tasks/install_normal.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vagrant/ansible/roles/kvm/tasks/install_normal.yml b/vagrant/ansible/roles/kvm/tasks/install_normal.yml index d55ad909..dba81283 100644 --- a/vagrant/ansible/roles/kvm/tasks/install_normal.yml +++ b/vagrant/ansible/roles/kvm/tasks/install_normal.yml @@ -3,16 +3,12 @@ command: "make -j{{ ansible_processor_vcpus }} bzImage" args: chdir: "{{ root_dir }}/kvm" - environment: - EXTRA_CFLAGS: "-Wno-error=use-after-free" become: false - name: build modules command: "make -j{{ ansible_processor_vcpus }} modules" args: chdir: "{{ root_dir }}/kvm" - environment: - EXTRA_CFLAGS: "-Wno-error=use-after-free" become: false - name: install modules From da515bd4ba7c73aa0e6c4bb671567494f4ada5a6 Mon Sep 17 00:00:00 2001 From: Mathieu Tarral Date: Tue, 1 Oct 2024 23:49:03 +0200 Subject: [PATCH 5/5] vagrantfile: downgrade to debian11 --- vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index 7d8e842c..84687df0 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -1,7 +1,7 @@ require 'rubygems' Vagrant.configure(2) do |config| - config.vm.box = "generic/debian12" + config.vm.box = "generic/debian11" config.vm.box_version = "4.3.12" config.vm.define "kvmi"