PeterMosmans / ansible-role-virtualbox-guest

Ansible role for building and installing VirtualBox guest additions
GNU General Public License v3.0
20 stars 22 forks source link

Does it work for CentOS7? #14

Open tin6150 opened 7 years ago

tin6150 commented 7 years ago

Great recipe! It is supposed to work for RHEL7 and equivalents, right? I am having problem running this in vagrant env. Host CentOS 7.3.1611, VirtualBox guest CentOS 7.4.1708.

When I run "vagrant provision", it errors out complaning that dpkg-query command not found. I am really not having any Debian-style system in this setup.

==> cen7: Running provisioner: ansible...
    cen7: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit="cen7" --inventory-file=/home/sn-gh/singhub/.vagrant/provisioners/ansible/inventory -v vagrantfile_playbook.yml
No config file found; using defaults

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [cen7]

TASK [PeterMosmans.virtualbox-guest : remove os packages version of virtualbox guest additions] ***
skipping: [cen7] => (item=[])  => {"changed": false, "item": [], "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : If virtualbox_version is set to auto then determine the host version] ***
changed: [cen7 -> localhost] => {"changed": true, "cmd": "vboxmanage --version | awk -F r '{print $1}'", "delta": "0:00:00.034522", "end": "2017-10-15 19:01:41.378912", "failed": false, "rc": 0, "start": "2017-10-15 19:01:41.344390", "stderr": "", "stderr_lines": [], "stdout": "5.1.28", "stdout_lines": ["5.1.28"]}

TASK [PeterMosmans.virtualbox-guest : Check if virtualbox_version could be determined] ***
skipping: [cen7] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : Override virtualbox_version if defaults set to auto] ***
ok: [cen7] => {"ansible_facts": {"virtualbox_version": "5.1.28"}, "changed": false, "failed": false}

TASK [PeterMosmans.virtualbox-guest : Determine if (the requested version of) vboxguestadditions is installed] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: vbox_guest_version.stdout != "{{
virtualbox_version }}"

changed: [cen7] => {"changed": true, "cmd": "modinfo vboxguest 2>/dev/null|awk '/^version/{print $2}'", "delta": "0:00:00.006800", "end": "2017-10-15 12:34:20.566478", "failed": false, "rc": 0, "start": "2017-10-15 12:34:20.559678", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

TASK [PeterMosmans.virtualbox-guest : Check if the ISO file is present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

ok: [cen7] => {"changed": false, "failed": false, "stat": {"atime": 1508070648.235735, "attr_flags": "", "attributes": [], "block_size": 4096, "blocks": 116200, "charset": "binary", "checksum": "d55f9cf26ea56adb1ebd977156989e8775ec4294", "ctime": 1508070648.225735, "dev": 64768, "device_type": 0, "executable": false, "exists": true, "gid": 0, "gr_name": "root", "inode": 100667255, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "0cdb1fc2c52ad6aea0dfc3d0123264c9", "mimetype": "application/x-iso9660-image", "mode": "0644", "mtime": 1508070648.0997353, "nlink": 1, "path": "/root/VBoxGuestAdditions.iso", "pw_name": "root", "readable": true, "rgrp": true, "roth": true, "rusr": true, "size": 59494400, "uid": 0, "version": "1229366248", "wgrp": false, "woth": false, "writeable": true, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}}

TASK [PeterMosmans.virtualbox-guest : Check if the CD is present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

skipping: [cen7] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : Check if CD or ISO file is present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

skipping: [cen7] => {"skip_reason": "Conditional result was False"}

TASK [PeterMosmans.virtualbox-guest : Download ISO file when the requested version is not present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

skipping: [cen7] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : Re-check if the ISO file is present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

ok: [cen7] => {"changed": false, "failed": false, "stat": {"atime": 1508070648.235735, "attr_flags": "", "attributes": [], "block_size": 4096, "blocks": 116200, "charset": "binary", "checksum": "d55f9cf26ea56adb1ebd977156989e8775ec4294", "ctime": 1508070648.225735, "dev": 64768, "device_type": 0, "executable": false, "exists": true, "gid": 0, "gr_name": "root", "inode": 100667255, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "0cdb1fc2c52ad6aea0dfc3d0123264c9", "mimetype": "application/x-iso9660-image", "mode": "0644", "mtime": 1508070648.0997353, "nlink": 1, "path": "/root/VBoxGuestAdditions.iso", "pw_name": "root", "readable": true, "rgrp": true, "roth": true, "rusr": true, "size": 59494400, "uid": 0, "version": "1229366248", "wgrp": false, "woth": false, "writeable": true, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}}

TASK [PeterMosmans.virtualbox-guest : Fail if CD or ISO file is still not present on the host] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

skipping: [cen7] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : Use correct ISO path (file or CD)] *******
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

ok: [cen7] => {"ansible_facts": {"ISO_path": "/root/VBoxGuestAdditions.iso"}, "changed": false, "failed": false}

TASK [PeterMosmans.virtualbox-guest : Check if VBoxGuest additions ISO is mounted] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

 [WARNING]: Consider using mount module rather than running mount

changed: [cen7] => {"changed": true, "cmd": "mount -l 2>/dev/null|awk '/VBOXADDITIONS/{print $3}'", "delta": "0:00:00.009564", "end": "2017-10-15 12:34:22.634959", "failed": false, "rc": 0, "start": "2017-10-15 12:34:22.625395", "stderr": "", "stderr_lines": [], "stdout": "/media/cdrom", "stdout_lines": ["/media/cdrom"]}

TASK [PeterMosmans.virtualbox-guest : Mount VBoxGuestAdditions] ****************
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: mount_path is defined and "{{ mount_path.stdout
}}" == ""

skipping: [cen7] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true}

TASK [PeterMosmans.virtualbox-guest : Check if VBoxGuest additions ISO is mounted] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

changed: [cen7] => {"changed": true, "cmd": "mount -l 2>/dev/null|awk '/VBOXADDITIONS/{print $3}'", "delta": "0:00:00.009092", "end": "2017-10-15 12:34:23.104322", "failed": false, "rc": 0, "start": "2017-10-15 12:34:23.095230", "stderr": "", "stderr_lines": [], "stdout": "/media/cdrom", "stdout_lines": ["/media/cdrom"]}

TASK [PeterMosmans.virtualbox-guest : Find out kernel version] *****************
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

ok: [cen7] => {"changed": false, "cmd": "uname -r", "delta": "0:00:00.003943", "end": "2017-10-15 12:34:23.533012", "failed": false, "rc": 0, "start": "2017-10-15 12:34:23.529069", "stderr": "", "stderr_lines": [], "stdout": "3.10.0-693.2.1.el7.x86_64", "stdout_lines": ["3.10.0-693.2.1.el7.x86_64"]}

TASK [PeterMosmans.virtualbox-guest : Find out architecture-independent kernel name] ***
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

ok: [cen7] => {"changed": false, "cmd": "uname -r | sed 's/-[az].*$//'", "delta": "0:00:00.005567", "end": "2017-10-15 12:34:23.950352", "failed": false, "rc": 0, "start": "2017-10-15 12:34:23.944785", "stderr": "", "stderr_lines": [], "stdout": "3.10.0-693.2.1.el7.x86_64", "stdout_lines": ["3.10.0-693.2.1.el7.x86_64"]}

TASK [PeterMosmans.virtualbox-guest : Save the current list of packages] *******
 [WARNING]: when statements should not include jinja2 templating delimiters
such as {{ }} or {% %}. Found: (vbox_guest_version.stdout != "{{
virtualbox_version }}")

fatal: [cen7]: FAILED! => {"changed": true, "cmd": "dpkg-query -l > /tmp/before.txt", "delta": "0:00:00.003910", "end": "2017-10-15 12:34:24.371988", "failed": true, "msg": "non-zero return code", "rc": 127, "start": "2017-10-15 12:34:24.368078", "stderr": "/bin/bash: dpkg-query: command not found", "stderr_lines": ["/bin/bash: dpkg-query: command not found"], "stdout": "", "stdout_lines": []}
    to retry, use: --limit @/home/sn-gh/singhub/vagrantfile_playbook.retry

PLAY RECAP *********************************************************************
cen7                       : ok=11   changed=4    unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again. 

Much thanks! Tin

PeterMosmans commented 7 years ago

Hi @tin6150 , thanks for the report.

Before your report It hadn't yet been tested on CentOS :wink: The dpkg is used to compare packages before and after installation. It would be possible to rewrite that for CentOS... would you be willing to help testing that feature ?

Cheers,

Peter

tin6150 commented 7 years ago

Certainly!