diff --git a/.github/workflows/libvirt.yml b/.github/workflows/libvirt.yml index cf635fe..14cf357 100644 --- a/.github/workflows/libvirt.yml +++ b/.github/workflows/libvirt.yml @@ -7,6 +7,9 @@ on: - master paths: - 'playbooks/prepare.yml' + - 'molecule/common/create.yml' + - 'molecule/common/templates/*.yml' + - 'molecule/common/vars.yml' - 'molecule/hosts/*.yml' - 'molecule/ipaddr/*.yml' - '.github/workflows/libvirt.yml' diff --git a/galaxy.yml b/galaxy.yml index 7df1fb9..45c2349 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: nephelaiio name: mongodb -version: 0.2.21 +version: 0.2.22 readme: README.md authors: - Ted Cook diff --git a/molecule/common/create.yml b/molecule/common/create.yml index f4511a1..44d1390 100644 --- a/molecule/common/create.yml +++ b/molecule/common/create.yml @@ -119,7 +119,6 @@ - name: Manage KVM guests when: inventory_hostname not in guest_query.stdout_lines block: - - name: Create KVM guest disks ansible.builtin.copy: remote_src: true @@ -182,12 +181,16 @@ xml: "{{ lookup('ansible.builtin.template', 'vm.j2.xml') }}" command: define vars: + _platforms: "{{ molecule_yml.platforms }}" + _platform: "{{ _platforms | selectattr('name', 'equalto', inventory_hostname) | first }}" guest_hostname: "{{ inventory_hostname }}" guest_disk_format: qcow2 guest_disk_path: "{{ _libvirt_path }}/{{ inventory_hostname }}.img" guest_iso_path: "{{ _libvirt_path }}/{{ inventory_hostname }}.iso" guest_network: "{{ _libvirt_network }}" guest_mac: "{{ '52:54:00' | random_mac(seed=guest_hostname) }}" + guest_mem: "{{ (_platform.mem | default(2)) * 1048576 }}" + guest_cpu: "{{ _platform.cpu | default(2) }}" loop_control: label: "{{ inventory_hostname }} - {{ _libvirt_path }}/{{ inventory_hostname }}.img" diff --git a/molecule/common/templates/vm.j2.xml b/molecule/common/templates/vm.j2.xml index a314e04..4c2734a 100644 --- a/molecule/common/templates/vm.j2.xml +++ b/molecule/common/templates/vm.j2.xml @@ -1,8 +1,8 @@ {{ guest_hostname }} - 4194304 - 4194304 - 2 + {{ guest_mem }} + {{ guest_mem }} + {{ guest_cpu }} /machine