csmart / ansible-role-virt-infra

Define and manage guests and networks on a KVM host with Ansible
GNU General Public License v3.0
67 stars 48 forks source link

["ERROR ", "--memory amount in MiB is required"], "stdout": "", "stdout_lines": []} #62

Closed dNodal0 closed 2 years ago

dNodal0 commented 2 years ago

Hello,

I get this error when I run the commade "./run.sh --limit kvmhost,simple"

my simple.yml:

simple: hosts: simple-centos-8-[1:1]: vars: ansible_python_interpreter: /usr/libexec/platform-python virt_infra_distro_image: "CentOS-Stream-GenericCloud-8-20210603.0.x86_64.qcow2" virt_infra_host_image_path: "/opt/kvm/images"

TASK [ansible-role-virt-infra : Define VM] ***** task path: /appli/virt-infra-ansible/roles/ansible-role-virt-infra/tasks/virt-create.yml:3 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"} FAILED - RETRYING: Define VM (10 retries left). FAILED - RETRYING: Define VM (9 retries left). FAILED - RETRYING: Define VM (8 retries left). FAILED - RETRYING: Define VM (7 retries left). FAILED - RETRYING: Define VM (6 retries left). FAILED - RETRYING: Define VM (5 retries left). FAILED - RETRYING: Define VM (4 retries left). FAILED - RETRYING: Define VM (3 retries left). FAILED - RETRYING: Define VM (2 retries left). FAILED - RETRYING: Define VM (1 retries left). fatal: [simple-centos-8-1 -> localhost]: FAILED! => {"attempts": 10, "changed": true, "cmd": "set -o pipefail && virt-install --import --connect qemu:///system --cpu host-passthrough --controller type=scsi,model=virtio-scsi,index=0 --disk /opt/kvm/images/simple-centos-8-1-boot.qcow2,serial=boot,boot_order=1,format=qcow2,bus=scsi --disk /opt/kvm/images/simple-centos-8-1-cloudinit.iso,device=cdrom,bus=scsi,format=iso --channel unix,target_type=virtio,name=org.qemu.guest_agent.0 --graphics spice --machine q35 --name simple-centos-8-1 --network network=default,mac=52:54:00:74:46:75,model=virtio --noreboot --noautoconsole # --events on_poweroff=preserve,on_reboot=restart --os-type linux # --memory 1024,maxmemory=1024 --memory 2048 --rng /dev/urandom --serial pty --sound none --vcpus 1,maxvcpus=1 --virt-type kvm\n", "delta": "0:00:01.059934", "end": "2022-02-13 21:02:16.343805", "msg": "non-zero return code", "rc": 1, "start": "2022-02-13 21:02:15.283871", "stderr": "ERROR \n--memory amount in MiB is required", "stderr_lines": ["ERROR ", "--memory amount in MiB is required"], "stdout": "", "stdout_lines": []}

Regards

csmart commented 2 years ago

Hi, I'm not sure why there are some # in there... any chance you could paste your inventory for me? Also, can you let me know what distro you're using?

Thanks! -c

dNodal0 commented 2 years ago

Hi,

my inventory:

---
## YAML based inventory, see:
## https://docs.ansible.com/ansible/latest/plugins/inventory/yaml.html
#
## Simple example using defaults to spin up 3 CentOS guests
## This is on multiple KVM hosts, see kvmhost.yml
simple:
  hosts:
    simple-centos-8-[1:1]:
  vars:
    ansible_python_interpreter: /usr/libexec/platform-python
    virt_infra_distro_image: "CentOS-Stream-GenericCloud-8-20210603.0.x86_64.qcow2"
    virt_infra_host_image_path: "/opt/kvm/images"
--------------------------------------------------------------------------
# --memory {{ virt_infra_ram }},maxmemory={{ virt_infra_ram_max }}
    --memory 2048

As I encountered the error of the memory, I commented the line and added a new one: but I have the same error :)

My distro : CentOS Stream release 8

Regarde,

csmart commented 2 years ago

Thanks, sorry is the hashed out memory option in the Ansible code? I've edited your comment to try and set it in code so it's easier to read, but maybe I got it wrong.

If you added that line in the code, could you delete any lines rather than commenting them out?

dNodal0 commented 2 years ago

Hello, Thank you for your quick answer, the code works perfectly after removing the commented line

Removed lines: --memory {{ virt_infra_ram }},maxmemory={{ virt_infra_ram_max }} replaced by --memory 2048 ` Thanks :)

csmart commented 2 years ago

Thanks for that. I'm surprised you had that problem on CentOS Stream 8 though... hmm... does this have the latest updates applied? I'll have to test it.

dNodal0 commented 2 years ago

Hi, Indeed, after installing the last updates, the role works perfectly without modification,

Thanks for your time :)

csmart commented 2 years ago

OK great, thanks.