# Zypper fails to install multiple dependant RPMs e.g. mysql

**URL:** <https://forum.ansible.com/t/zypper-fails-to-install-multiple-dependant-rpms-e-g-mysql/28977>\
**Category:** Ansible Project\
**Created:** [November 8, 2018, 2:41pm UTC](https://forum.ansible.com/t/zypper-fails-to-install-multiple-dependant-rpms-e-g-mysql/28977 "2018-11-08T14:41:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dean\_warren](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dean\_warren](https://forum.ansible.com/u/dean_warren)\
**Post date:** [November 8, 2018, 2:41pm UTC](https://forum.ansible.com/t/zypper-fails-to-install-multiple-dependant-rpms-e-g-mysql/28977/1 "2018-11-08T14:41:49Z")

</div>

Trying to install mysql on SLES 12 SP1 using Ansible 2.7

Following officail mysql documentation as per here:  
[https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html](https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html)

i.e. using the following command:

```auto
sudo zypper install mysql-community-{server,client,common,libs}-* --exclude='*minimal*'

This works fine on my SLES 12 at the command-line. But when using the Zypper module in Ansible it fails.
e.g.

Assuming RPM' are present in the folder /tmp with appropriate permissions and ownership etc...

The following three tasks:

1)

- name: install mysql
  become: true
  zypper:
    name: /tmp/mysql-community-{server,client,common,libs}-*
    state: present

Gives the following error:

Zypper run command failed with return code 4.
Problem occurred initializing or executing the search query: Invalid regular expression (/tmp/mysql-5.7.22-1/mysql-community-{server|client|common|libs}-*) regcomp returned 10.
See the above message for a hint. Running zypper refresh as root might resolve the problem.

2)

- name: install mysql
  become: true
  zypper:
    name: /tmp/mysql-community-common-5.7.22-1.sles12.x86_64.rpm \
          /tmp/mysql-community-libs-5.7.22-1.sles12.x86_64.rpm \
          /tmp/mysql-community-client-5.7.22-1.sles12.x86_64.rpm \
          /tmp/mysql-community-server-5.7.22-1.sles12.x86_64.rpm
    state: present

Give the following error:

Zypper run command failed with return code 3. Specified local path does not exist or is not accessible. Problem retrieving the specified RPM file. Malformed URI: Please check whether the file is accessible.
Problem with the RPM file specified as /tmp/mysql-community-common-5.7.22-1.sles12.x86_64.rpm \ /tmp/mysql-community-libs-5.7.22-1.sles12.x86_64.rpm \ /tmp/mysql-community-client-5.7.22-1.sles12.x86_64.rpm \ /tmp/mysql-community-server-5.7.22-1.sles12.x86_64.rpm, skipping. No valid arguments specified.

3)

- name: install mysql client
  become: true
  zypper:
    name: /tmp/mysql-community-*
    state: present

Gives the following error:

No provider of /tmp/mysql-community-* found.

I guess I could use shell or command module, running either Zypper or RPM, but would prefer to use the zypper module.

Any suggestions?

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 9, 2018, 5:21am UTC](https://forum.ansible.com/t/zypper-fails-to-install-multiple-dependant-rpms-e-g-mysql/28977/2 "2018-11-09T05:21:42Z")

</div>

> 1)  
> - name: install mysql  
> &nbsp;&nbsp;become: true  
> &nbsp;&nbsp;zypper:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: /tmp/mysql-community-{server,client,common,libs}-\*  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present
> 
> Gives the following error:  
> Zypper run command failed with return code 4.  
> Problem occurred initializing or executing the search query: Invalid regular expression (/tmp/mysql-5.7.22-1/mysql-community-{server|client|common|libs}-\*) regcomp returned 10.  
> See the above message for a hint. Running zypper refresh as root might resolve the problem.

Documentation say you only can use \* with state: latest and then the name can only be a '\*' aka upgrade all.

> 2)
> 
> - name: install mysql  
> &nbsp;&nbsp;become: true  
> &nbsp;&nbsp;zypper:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: /tmp/mysql-community-common-5.7.22-1.sles12.x86\_64.rpm \  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/tmp/mysql-community-libs-5.7.22-1.sles12.x86\_64.rpm \  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/tmp/mysql-community-client-5.7.22-1.sles12.x86\_64.rpm \  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/tmp/mysql-community-server-5.7.22-1.sles12.x86\_64.rpm  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present
> 
> Give the following error:  
> Zypper run command failed with return code 3. Specified local path does not exist or is not accessible. Problem retrieving the specified RPM file. Malformed URI: Please check whether the file is accessible.  
> Problem with the RPM file specified as /tmp/mysql-community-common-5.7.22-1.sles12.x86\_64.rpm \\ /tmp/mysql-community-libs-5.7.22-1.sles12.x86\_64.rpm \\ /tmp/mysql-community-client-5.7.22-1.sles12.x86\_64.rpm \\ /tmp/mysql-community-server-5.7.22-1.sles12.x86\_64.rpm, skipping. No valid arguments specified.

There is no packed called  
"/tmp/mysql-community-common-5.7.22-1.sles12.x86\_64.rpm \ /tmp/mysql-community-libs-5.7.22-1.sles12.x86\_64.rpm \ /tmp/mysql-community-client-5.7.22-1.sles12.x86\_64.rpm \ /tmp/mysql-community-server-5.7.22-1.sles12.x86\_64.rpm"

according to the documentation you need one name or package specifier, if you need more than one it takes a list.

> 3)  
> - name: install mysql client  
> &nbsp;&nbsp;become: true  
> &nbsp;&nbsp;zypper:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: /tmp/mysql-community-\*  
> &nbsp;&nbsp;&nbsp;&nbsp;state: present
> 
> Gives the following error:  
> No provider of /tmp/mysql-community-\* found.

"A repeat of my first comment."

> I guess I could use shell or command module, running either Zypper or RPM, but would prefer to use the zypper module.
> 
> Any suggestions?

Disclaimer:  
Never used zypper just read the documentation  
[https://docs.ansible.com/ansible/latest/modules/zypper\_module.html](https://docs.ansible.com/ansible/latest/modules/zypper_module.html)
