dnf module problem with modularity appstreams and groups

Ansible 2.8.5

I’m having trouble with installing package groups and modularity appstreams on a CentOS 8 host using the dnf module. Whilst it mostly seems like two separate issues, the errors I’m getting make me wonder if it’s one underlying issue.

If I try to use the dnf module to install a modularity appstream on a CentOS 8 host like this

$ ansible 192.168.122.90 -m dnf -a “name=‘@postgresql:9.6’ state=present”

I get this

192.168.122.90 | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“msg”: “No group postgresql:9.6 available.”
}

@postgresql:9.6’ is the example used at https://docs.ansible.com/ansible/latest/modules/dnf_module.html

Note “No group” in the error message, which is what makes me wonder if the failure is due to the same underlying issue I’m having with package groups (below).

If I try the equivalent at the command line on the CentOS 8 host

dnf install @postgresql:9.6

that works as expected.

If I tell Ansible to install a package group

$ ansible 192.168.122.90 dnf -m yum -a “name=‘@Development tools’ state=present”

192.168.122.90 | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“module_stderr”: “Shared connection to 192.168.122.90 closed.\r\n”,
“module_stdout”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1569593714.55-61643763674096/AnsiballZ_dnf.py", line 114, in \r\n _ansiballz_main()\r\n File "/root/.ansible/tmp/ansible-tmp-1569593714.55-61643763674096/AnsiballZ_dnf.py", line 106, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/root/.ansible/tmp/ansible-tmp-1569593714.55-61643763674096/AnsiballZ_dnf.py", line 49, in invoke_module\r\n imp.load_module(‘main’, mod, module, MOD_DESC)\r\n File "/usr/lib64/python3.6/imp.py", line 235, in load_module\r\n return load_source(name, filename, file)\r\n File "/usr/lib64/python3.6/imp.py", line 170, in load_source\r\n module = _exec(spec, sys.modules[name])\r\n File "", line 618, in _exec\r\n File "", line 678, in exec_module\r\n File "", line 219, in _call_with_frames_removed\r\n File "/tmp/ansible_dnf_payload_egtlqrub/main.py", line 436, in \r\n File "/tmp/ansible_dnf_payload_egtlqrub/main.py", line 430, in main\r\n File "/tmp/ansible_dnf_payload_egtlqrub/main.py", line 293, in ensure\r\n File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1587, in group_install\r\n assert dnf.util.is_string_type(grp_id)\r\nAssertionError\r\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1

}

If I log in the CentOS 8 host and run

$ dnf install ‘@Development Tools’

that works as expected. Also this works

$ ansible 192.168.122.90 -m dnf -a “name=‘@Workstation’ state=present”

From that plus trying some other group names it seems like the dnf module can install groups so long a their name is a single word but otherwise it fails entirely.

I get the same behaviour with the yum module. (/usr/bin/yum on CentOS 8 is symlink to dnf.)

Doing the equivalent with yum module against a CentOS 7.7 target works, E.g.

$ ansible foo7 -m yum -a “name=‘@Development tools’ state=present”