# openSUSE Leap: Installing rsyslog with zypper module

**URL:** <https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527>\
**Category:** Ansible Project\
**Created:** [May 23, 2016, 5:16pm UTC](https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527 "2016-05-23T17:16:59Z")\
**Posts on this page:** 4\
**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:** [May 23, 2016, 5:16pm UTC](https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527/1 "2016-05-23T17:16:59Z")

</div>

Dear all,

does the zypper module combine all calls made with with\_items into on  
single command like the yum module does? I guess not...

Target Host is a VM with openSUSE Leap 42.1

I want to install rsyslog, which conflicts with systemd-logger (whose  
only purpose is to provide an explanation why it conflicts... 😉 ).  
So the solution is to install rsyslog and uninstall systemd-logger in  
on call. On the cli I would do:

sudo zypper install rsyslog -systemd-logger

I tried to do the same with the zypper module:

> zypper: name="{{ item.name }}" state="{{ item.state }}"  
> with\_items:  
> &nbsp;&nbsp;- name: rsyslog  
> &nbsp;&nbsp;&nbsp;&nbsp;state: latest  
> &nbsp;&nbsp;- name: systemd-logger  
> &nbsp;&nbsp;&nbsp;&nbsp;state: absent

But this shows the error I get when I try to just install rsyslog  
manually.

A task calling zypper via shell works:

> shell: zypper in -y rsyslog -systemd-logger

Is this intentional? Did I miss some other way to get the package  
installed without the conflict?

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:** [May 30, 2016, 9:21am UTC](https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527/2 "2016-05-30T09:21:28Z")

</div>

Johannes Kastl [23.05.2016 19:16]:

> Dear all,
> 
> does the zypper module combine all calls made with with\_items into on  
> single command like the yum module does? I guess not...
> 
> Target Host is a VM with openSUSE Leap 42.1
> 
> I want to install rsyslog, which conflicts with systemd-logger (whose  
> only purpose is to provide an explanation why it conflicts... 😉 ).  
> So the solution is to install rsyslog and uninstall systemd-logger in  
> on call. On the cli I would do:
> 
> sudo zypper install rsyslog -systemd-logger
> 
> I tried to do the same with the zypper module:
> 
> > zypper: name="{{ item.name }}" state="{{ item.state }}"  
> > with\_items:  
> > &nbsp;&nbsp;- name: rsyslog  
> > &nbsp;&nbsp;&nbsp;&nbsp;state: latest  
> > &nbsp;&nbsp;- name: systemd-logger  
> > &nbsp;&nbsp;&nbsp;&nbsp;state: absent
> 
> But this shows the error I get when I try to just install rsyslog  
> manually.
> 
> A task calling zypper via shell works:
> 
> > shell: zypper in -y rsyslog -systemd-logger
> 
> Is this intentional? Did I miss some other way to get the package  
> installed without the conflict?
> 
> Johannes

Johannes,

when I look at the Python code, I guess that it is not interpreted as  
one command due to the "present" for one item and the "absent" for the  
other. I think this splits the call of zypper into one "zypper in" and  
one "zypper rm" call. This will fail due to the dependencies.

Can you try  
&nbsp;&nbsp;- name: "-systemd-logger"  
&nbsp;&nbsp;&nbsp;&nbsp;state: present  
in your playbook?

Btw, internally the module uses "/usr/bin/zypper --non-interactive",  
there is no need for "-y" on the command line if you use that 😉

HTH,  
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:** [May 30, 2016, 12:42pm UTC](https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527/3 "2016-05-30T12:42:47Z")

</div>

Hi Werner,

> when I look at the Python code, I guess that it is not interpreted as  
> one command due to the "present" for one item and the "absent" for the  
> other. I think this splits the call of zypper into one "zypper in" and  
> one "zypper rm" call. This will fail due to the dependencies.
> 
> Can you try  
> &nbsp;&nbsp;- name: "-systemd-logger"  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present  
> in your playbook?

I will try this, yes.

> Btw, internally the module uses "/usr/bin/zypper --non-interactive",  
> there is no need for "-y" on the command line if you use that 😉

If you mean in the shell-task? There it is needed, otherwise the  
command hangs while asking for confirmation.  
Then module of course does not require any "-y" or similar.

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:** [May 30, 2016, 12:49pm UTC](https://forum.ansible.com/t/opensuse-leap-installing-rsyslog-with-zypper-module/21527/4 "2016-05-30T12:49:03Z")

</div>

Johannes Kastl [30.05.2016 14:42]:

> Hi Werner,
> 
> > Btw, internally the module uses "/usr/bin/zypper --non-interactive",  
> > there is no need for "-y" on the command line if you use that 😉
> 
> If you mean in the shell-task? There it is needed, otherwise the  
> command hangs while asking for confirmation.  
> Then module of course does not require any "-y" or similar.

The command does not ask for confirmation if you use "--non-interactive"  
or its short form "-n". The syntax here is "zypper -n install", which is  
different from "zypper install -n" 🙂

Werner
