zypper module dependency (catch 22)

143 views
Skip to first unread message

Josef Fortier

unread,
Nov 5, 2019, 3:56:28 PM11/5/19
to Ansible Project
Updated to ansible 2.9 and ran into a (semi) circular dependency for suse.
The zypper package now requires a non-stock python module, which... means it cannot be installed via the zypper module.

Workaround is to use the command module to install via zypper, but this seems an odd choice. Shouldn't this just warn rather then force the install?

Matt Martz

unread,
Nov 5, 2019, 4:12:01 PM11/5/19
to ansible...@googlegroups.com
What non-stock module is required that is causing issues?  The ansible module seems to only require default python modules.

Maybe you could explain your situation it more detail?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7ad0a2c9-69ac-4d93-923d-2f3b220766ae%40googlegroups.com.


--
Matt Martz
@sivel
sivel.net

Josef Fortier

unread,
Nov 5, 2019, 4:57:43 PM11/5/19
to Ansible Project
Playbook is simple cleanup of unneeded packages. Task like (without loop)

- name: remove unneeded package
  zypper:
    name: cups
    state: absent

After update to 2.9 this error is thrown:

failed: [internum.augsburg.edu] (item=xhost) => {"ansible_loop_var": "item", "changed": false, "item": "xhost", "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 94, in _ansiballz_main\n  File \"<stdin>\
", line 40, in invoke_module\n  File \"/usr/lib64/python2.7/runpy.py\", line 192, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_zypper_payload_2pSpWr/ansible_zypper_payload.zip/ansible/modules/packaging/
os/zypper.py\", line 195, in <module>\nImportError: No module named xml\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
2019-11-05 14:50:47,427 p=fortier u=11890 | ok: [herodotus.augsburg.edu] => (item=cups-libs-32bit)

There's a fair amount of noise in this error message (loop and hosts) but as I'm reading it, the key issue is 

ImportError: No module named xml

I then tried loading python-xml (the dependency is mentioned in the current docs) with this:

- name: load required ansible python module
  zypper:
    - name: python-xml
    - state: present

And received the same error.

I sort of get what's going on here, current version of zypper have rich xml support, which is easier/cleaner/more-accurate than parsing CLI output, but it seems to me a regression to not allow the older style (with a warning).


What non-stock module is required that is causing issues?  The ansible module seems to only require default python modules.

Maybe you could explain your situation it more detail?

On Tue, Nov 5, 2019 at 2:56 PM Josef Fortier <josef....@gmail.com> wrote:
Updated to ansible 2.9 and ran into a (semi) circular dependency for suse.
The zypper package now requires a non-stock python module, which... means it cannot be installed via the zypper module.

Workaround is to use the command module to install via zypper, but this seems an odd choice. Shouldn't this just warn rather then force the install?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Matt Martz

unread,
Nov 6, 2019, 9:51:00 AM11/6/19
to ansible...@googlegroups.com
That is interesting. I've not seen a distro that separated out the xml module into its own package as that is part of the CPython standard library.

Perhaps you have some python-minimal installed instead of a full python?

Fwiw, our suse images we are using in CI do not suffer from this problem.

On another note, sometimes hosts may be lacking dependencies that are fundamental to Ansible functioning. Often the tasks to ensure the systems meet the requirements to be managed by ansible are called "bootstrap" tasks, and are typically just command/shell/script/raw tasks that can configure a system at a minimal level to get necessary deps installed.  So it is not unheard of to have these types of tasks.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/793a3ecd-73c3-43c3-8f3e-aeef21d8a705%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages