geerlingguy/ansible-role-java

RHEL 8 Support

damien-swarm opened this issue · 3 comments

What needs to be done for RHEL 8 support?

I tried running this role on a (basically) fresh RHEL 8 instance on AWS; I copied vars/RedHat-7.yml to vars/RedHat-8.yml and ran into the following error (formatted with some extra newlines to be more readable):

TASK [geerlingguy.java : Ensure Java is installed.] *************************************************************************
fatal: [172.31.13.124]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 172.31.13.124 closed.\r\n", 
"module_stdout": "Traceback (most recent call last):\r\n  File \"/usr/lib/python3.6/site-packages/dnf/repo.py\", line 566, in load\r\n    ret = self._repo.load()\r\n  
File \"/usr/lib64/python3.6/site-packages/libdnf/repo.py\", line 503, in load\r\n    return _repo.Repo_load(self)\r\n
RuntimeError: Failed to synchronize cache for repo 'rhui-client-config-server-8'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\n
Traceback (most recent call last):\r\n  
File \"/tmp/ansible_rqq_7rmb/ansible_module_dnf.py\", line 534, in <module>\r\n    main()\r\n  
File \"/tmp/ansible_rqq_7rmb/ansible_module_dnf.py\", line 528, in main\r\n    params['disablerepo'], params['enablerepo'], params['installroot'])\r\n  
File \"/tmp/ansible_rqq_7rmb/ansible_module_dnf.py\", line 251, in _base\r\n    base.fill_sack(load_system_repo='auto')\r\n  
File \"/usr/lib/python3.6/site-packages/dnf/base.py\", line 400, in fill_sack\r\n    self._add_repo_to_sack(r)\r\n  
File \"/usr/lib/python3.6/site-packages/dnf/base.py\", line 135, in _add_repo_to_sack\r\n    repo.load()\r\n  
File \"/usr/lib/python3.6/site-packages/dnf/repo.py\", line 568, in load\r\n    raise dnf.exceptions.RepoError(str(e))\r\n
dnf.exceptions.RepoError: Failed to synchronize cache for repo 'rhui-client-config-server-8'\r\n", "msg": "MODULE FAILURE", "rc": 0}

Not sure if this is easy to fix (I was unable to fix it in 5 minutes), or if there are further problems down the line...

I'm not using RHEL 8 at the moment, but I have had possibly related issues on CentOS 7.6 with Python 3.6, and would like to get RHEL 8 working soon.

Beyond the specific error from with the dnf module above, you may be running into the difference between Yum 3 and Yum 4 - the latter is based on the new DNF package manager, which replaces the original Yum 3. Yum 4 and DNF are in preview on CentOS 7.6 and the default in RHEL 8.

  • this role uses the package module, which maps to dnf module on RHEL 8 (possibly to the yum module with dnf backend), and to yum module on RHEL 7.x

There is an interaction with Python 3 here - I found that, although Ansible runs fine on Python 3 generally, the Ansible yum module actually requires Yum 4. Since this is in preview on CentOS 7.6 I ended up making Ansible run on Python 2.7 so that I could use Yum 3.

For RHEL 8, I think you would need to use Yum 4 or DNF. For Python 3 on CentOS 7.6, I think it's best to force the Yum 3 backend with the yum module.

Some background that may be useful:

On the specific error, your DNF cache may be corrupt, or you might need to configure HTTP proxy setup, etc - Google results for Failed to synchronize cache for repo "rhui-client-config-server-8" may be helpful.

Taking a look now. This shouldn't be too difficult to implement, as I now have a CentOS 8 test/CI environment.

Looks like in RHEL 8 available versions are:

  • java-1.8.0-openjdk
  • java-11-openjdk
  • java-latest-openjdk