ansible/ansible — pull request #3145 by dirtyharrycallahan (2013-06-07 02:09:33+00:00)
Title: Simple zypper module to install, remove, or upgrades packages.

Tested on openSuSE 12.3 and should work on SuSE 11. ansible.spec needs some changes to build on SuSE. Not a lot of python coding so it may not be idiomatic python.

Here's the output of some of my testing.

Script started on Thu 06 Jun 2013 09:50:07 PM EDT

patrickc@linux-sngq:~/Projects/ansible/rpm-build> rpm -qi zsh

Name : zsh
Version : 5.0.2
Release : 2.9.1
Architecture: x86_64
Install Date: Wed 05 Jun 2013 12:03:00 AM EDT
Group : System/Shells
Size : 7232480
License : MIT
Signature : RSA/SHA256, Thu 02 May 2013 08:36:34 AM EDT, Key ID b88b2fd43dbdc284
Source RPM : zsh-5.0.2-2.9.1.src.rpm
Build Date : Mon 22 Apr 2013 10:01:07 AM EDT
Build Host : build09
Relocations : (not relocatable)
Packager : http://bugs.opensuse.org
Vendor : openSUSE
URL : http://www.zsh.org
Summary : Shell with comprehensive completion
Description :
Zsh is a UNIX command interpreter (shell) that resembles the Korn shell
(ksh). It is not completely compatible. It includes many enhancements,
notably in the command-line editor, options for customizing its
behavior, file name globbing, features to make C-shell (csh) users feel
at home, and extra features drawn from tcsh (another `custom' shell).
Zsh is well known for its command line completion.
Distribution: openSUSE 12.3

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "name=zsh state=present" -K
sudo password:

localhost | success >> {
"changed": false,
"name": "zsh",
"state": "present"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "name=zsh state=present" -K
sudo password:

localhost | success >> {
"changed": false,
"name": "zsh",
"state": "present"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "pkg=zsh state=present" -K
sudo password:

localhost | success >> {
"changed": false,
"name": "zsh",
"state": "latest"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "pkg=zsh state=latest" -K
sudo password:

localhost | success >> {
"changed": true,
"name": "zsh",
"state": "absent"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "pkg=zsh state=absent" -K
sudo password:

localhost | success >> {
"changed": false,
"name": "foo",
"state": "absent"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "pkg=foo state=absent" -K
sudo password:

localhost | FAILED >> {
"failed": true,
"msg": "No provider of 'foo' found.\n"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> ansible localhost -m zypper -a "pkg=foo state=present" -K

localhost | success >> {
"changed": true,
"name": "zsh",
"state": "present"
}

patrickc@linux-sngq:~/Projects/ansible/rpm-build> rpm -qi zsh

Name : zsh
Version : 5.0.2
Release : 2.9.1
Architecture: x86_64
Install Date: Thu 06 Jun 2013 09:55:07 PM EDT
Group : System/Shells
Size : 7232480
License : MIT
Signature : RSA/SHA256, Thu 02 May 2013 08:36:34 AM EDT, Key ID b88b2fd43dbdc284
Source RPM : zsh-5.0.2-2.9.1.src.rpm
Build Date : Mon 22 Apr 2013 10:01:07 AM EDT
Build Host : build09
Relocations : (not relocatable)
Packager : http://bugs.opensuse.org
Vendor : openSUSE
URL : http://www.zsh.org
Summary : Shell with comprehensive completion
Description :
Zsh is a UNIX command interpreter (shell) that resembles the Korn shell
(ksh). It is not completely compatible. It includes many enhancements,
notably in the command-line editor, options for customizing its
behavior, file name globbing, features to make C-shell (csh) users feel
at home, and extra features drawn from tcsh (another `custom' shell).
Zsh is well known for its command line completion.
Distribution: openSUSE 12.3