# zypper module no longer working in check\_mode: unknown option '--dry-run'

**URL:** <https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415>\
**Category:** Ansible Project\
**Created:** [January 10, 2017, 11:10am UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415 "2017-01-10T11:10:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 10, 2017, 11:10am UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/1 "2017-01-10T11:10:59Z")

</div>

Dear all,

the zypper module (and thus the package module) is no longer working  
on my openSUSE Leap 42.1 / 42.2 or Tumbleweed machines, since zypper  
does not like being called with --dry-run in check\_mode:

fatal: [XXX]: FAILED! =\> {"changed": false, "cmd": ["/usr/bin/zypper",  
"--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],  
"failed": true, "msg": "Zypper run command failed with return code  
2.", "rc": 2, "stderr": "Unbekannte Option'--dry-run'\n", "stdout":  
"\<?xml version='1.0'?\>\n\<stream\>\n\</stream\>\n", "stdout\_lines":  
["\<?xml version='1.0'?\>", "\<stream\>", "\</stream\>"]}

The same task works without flaws when not in check\_mode.

I have tested ansible 2.2 on both a linux and OSX machine with the  
same result.

The machines in question have the following versions of \*zypp\* installed:

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [January 10, 2017, 11:40am UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/2 "2017-01-10T11:40:17Z")

</div>

10 janvier 2017 12:12 "Johannes Kastl" \<mail@ojkastl.de\> a écrit:

> Dear all,
> 
> the zypper module (and thus the package module) is no longer working  
> on my openSUSE Leap 42.1 / 42.2 or Tumbleweed machines, since zypper  
> does not like being called with --dry-run in check\_mode:
> 
> fatal: [XXX]: FAILED! =\> {"changed": false, "cmd": ["/usr/bin/zypper",  
> "--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],  
> "failed": true, "msg": "Zypper run command failed with return code  
> 2.", "rc": 2, "stderr": "Unbekannte Option'--dry-run'\n", "stdout":  
> "\<?xml version='1.0'?\>\n\<stream\>\n\</stream\>\n", "stdout\_lines":  
> ["\<?xml version='1.0'?\>", "\<stream\>", "\</stream\>"]}

Because some part of your error is in German... At a guess, perhaps you should try to  
set these variables to ansible.cfg, it saved my life with some other modules (I'm french and some server are in Frenche)

module\_lang = C  
module\_set\_locale = True

If it solved your problem, you should open a bug report

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 10, 2017, 11:57am UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/3 "2017-01-10T11:57:17Z")

</div>

Hi,

thanks for your answer.

> Because some part of your error is in German...

This is just because the error messages are displayed in another  
locale, but there are still error messages:

fatal: [XXX]: FAILED! =\> {"changed": false, "cmd": ["/usr/bin/zypper",  
"--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],  
"failed": true, "msg": "Zypper run command failed with return code  
2.", "rc": 2, "stderr": "Unknown option '--dry-run'\n", "stdout":  
"\<?xml version='1.0'?\>\n\<stream\>\n\</stream\>\n", "stdout\_lines":  
["\<?xml version='1.0'?\>", "\<stream\>", "\</stream\>"]}

zypper does not have a --dry-run switch (anymore) apparently.

Johannes

---

<div class="post-metadata">

**Author:** ![Werner\_Flamme](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@Werner\_Flamme](https://forum.ansible.com/u/Werner_Flamme)\
**Post date:** [January 10, 2017, 1:01pm UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/4 "2017-01-10T13:01:47Z")

</div>

Johannes Kastl [10.01.2017 12:57]:

> Hi,
> 
> thanks for your answer.
> 
> > Because some part of your error is in German...
> 
> This is just because the error messages are displayed in another  
> locale, but there are still error messages:
> 
> fatal: [XXX]: FAILED! =\> {"changed": false, "cmd": ["/usr/bin/zypper",  
> "--quiet", "--non-interactive", "--xmlout", "refresh", "--dry-run"],  
> "failed": true, "msg": "Zypper run command failed with return code  
> 2.", "rc": 2, "stderr": "Unknown option '--dry-run'\n", "stdout":  
> "\<?xml version='1.0'?\>\n\<stream\>\n\</stream\>\n", "stdout\_lines":  
> ["\<?xml version='1.0'?\>", "\<stream\>", "\</stream\>"]}
> 
> zypper does not have a --dry-run switch (anymore) apparently.
> 
> Johannes

Johannes,

I do not think so.

On Leap 42.2, I get

---snip---  
# rpm -qa '\*zypp\*' | sort  
PackageKit-backend-zypp-1.1.3-2.3.x86\_64  
etckeeper-zypp-plugin-1.18.5-11.3.x86\_64  
libzypp-16.3.2-3.1.x86\_64  
snapper-zypp-plugin-0.3.3-2.2.noarch  
zypp-plugin-python-0.5-5.3.x86\_64  
zypper-1.13.14-3.1.x86\_64  
zypper-aptitude-1.13.14-3.1.noarch  
zypper-log-1.13.14-3.1.noarch  
---pins---

Yes, there was a patch for zypper, I think it came in yesterday. The  
command I took as sample ("zypper in --dry-run ossec-hids") finished  
without errors.

Maybe it helps to patch zypper via "zypper patch" 🙂

Regards,  
Werner

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 11, 2017, 3:00pm UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/5 "2017-01-11T15:00:18Z")

</div>

Hi Werner,

> Yes, there was a patch for zypper, I think it came in yesterday. The  
> command I took as sample ("zypper in --dry-run ossec-hids") finished  
> without errors.

I did some more testing (which I had no time for yesterday).

The problem is the "update\_cache" option to the zypper module. If this  
is set to yes, then 'zypper refresh' is called before the actual  
installation attempt. And 'zypper refresh --dry-run' does not work and  
thus throws the error. IN contrast to the actual installation, which  
accepts the --dry-run switch.

So for now I changed my task to not refresh the repositories before  
installation and the play works.

Where to report this bug?

Johannes

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 11, 2017, 3:28pm UTC](https://forum.ansible.com/t/zypper-module-no-longer-working-in-check-mode-unknown-option-dry-run/23415/6 "2017-01-11T15:28:30Z")

</div>

I issued this:  
\<[https://github.com/ansible/ansible/issues/20139&gt](https://github.com/ansible/ansible/issues/20139&gt);

Johannes
