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

252 views
Skip to first unread message

dean warren

unread,
Nov 8, 2018, 9:41:49 AM11/8/18
to Ansible Project
Trying to install mysql on SLES 12 SP1 using Ansible 2.7

Following officail mysql documentation as per here:

i.e. using the following command:
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?





Kai Stian Olstad

unread,
Nov 9, 2018, 12:21:53 AM11/9/18
to ansible...@googlegroups.com
On Thursday, 8 November 2018 15:41:49 CET dean warren wrote:
> 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.

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


> 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.

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
> become: true
> zypper:
> name: /tmp/mysql-community-*
> 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


--
Kai Stian Olstad


Reply all
Reply to author
Forward
0 new messages