RedHatOfficial / ocp4-vsphere-upi-automation

Automates most of the manual steps of deploying OCP4.x cluster on vSphere
MIT License
131 stars 107 forks source link

RHEL 7.9 static_ips_ova playbook issues #87

Closed filiy closed 3 years ago

filiy commented 3 years ago

When the running the static_ips_ova.yml playbook on a RHEL 7.9 vm using Ansible 2.9 & python2 this error.

TASK [common : Install pyvmomi] ********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/bin/pip2", "install", "pyvmomi"], "msg": "stdout: Collecting pyvmomi\n  Downloading https://files.pythonhosted.org/packages/da/ec/38044d41138a687930687f6b990c9dfe8d863dfcbae3ea16f346d3a78131/pyvmomi-7.0.2.tar.gz (589kB)\n    Complete output from command python setup.py egg_info:\n    /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'\n      warnings.warn(msg)\n    error in pyvmomi setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.\n    \n    ----------------------------------------\n\n:stderr: Command \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-build-HWMnxa/pyvmomi/\nYou are using pip version 8.1.2, however version 21.2.4 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n"}

Looking at https://pypi.org/project/pyvmomi/ I can see python2 is deprecated.

So from the RHEL 7.9 VM python3 is installed. And yum remove ansible is run. Then ansible is installed with python3 pip3 install ansible.

ansible_python_interpreter: /usr/bin/python3 is added to the inventory file and the static_ips_ova.yml playbook is run again. Things get further but I'm stuck at this error.

TASK [static_ips_ova : Create bootstrap VM from the template] ************************************************************************************************************************************
failed: [localhost] (item={'name': 'bootstrap', 'ipaddr': '10.0.200.110', 'cpu': 4, 'ram': 16384, 'datastore': 'datastore1'}) => {"ansible_loop_var": "item", "changed": false, "item": {"cpu": 4, "datastore": "datastore1", "ipaddr": "10.0.200.110", "name": "bootstrap", "ram": 16384}, "msg": "Failed to create a virtual machine : Customization of the guest operating system 'rhel7_64Guest' is not supported in this configuration. Microsoft Vista (TM) and Linux guests with Logical Volume Manager are supported only for recent ESX host and VMware Tools versions. Refer to vCenter documentation for supported configurations."}

Seems like something with the ansible vmware_guest module and the customvalues options. https://github.com/RedHatOfficial/ocp4-vsphere-upi-automation/blob/master/roles/static_ips_ova/tasks/main.yml#L71

If we run the same playbook with the same variables on a RHEL 8.4 VM things work fine.

I'm thinking something to do with pyvmomi and python modules.

Any idea what could be the issue? Should this be working from RHEL 7.9? Maybe call out in the README if this is only tested or known to be working on RHEL 8?

Thanks!

filiy commented 3 years ago

A co-worker found the fix for running this playbook on RHEL7.

  1. Download the package unpack. - https://pypi.org/project/pyvmomi/#files
  2. Install the 2 require packages - pip install six requests
  3. Edit the setup.py & remove 'pywin32; sys_platform == "win32"' line.
  4. Install - python2 setup.py install

For some reason python3-dnf is not available on RHEL7, so it fallbacks to python 2.7 to install.