Commit graph

201 commits

Author SHA1 Message Date
Blair Zajac
4a6c68e98a apt: pass child process stdout and stdout to m.fail_json() and m.exit_json().
Without this, this fails:

    - name: apt-get dist-upgrade
      action: apt upgrade=dist
      register: apt_get_contents

    - name: apt-get clean
      action: command apt-get clean
      when: apt_get_contents.stdout.find("0 upgraded") == -1

TASK: [apt-get clean] *********************************************************

fatal: [192.168.2.2] => error while evaluating conditional: {% if apt_get_contents.stdout.find("0 upgraded") == -1 %} True {% else %} False {% endif %}

FATAL: all hosts have already failed -- aborting
2013-09-28 16:28:18 -07:00
abelbabel
51cebb062d typo 2013-09-25 18:50:41 +02:00
abelbabel
19db4d381c removed typo 2013-09-25 18:38:46 +02:00
abelbabel
9e88993939 add check mode support
Could it be that easy or do I have missed something?
2013-09-25 17:51:17 +02:00
Pieter Avonts
42e4d8cb30 changed deprecated channel_label attribute 2013-09-20 12:58:43 +02:00
René Moser
2e649d21af Fixed missing required package in notes. 2013-09-19 19:34:15 +02:00
James Cammarata
bb36429fa2 Merge branch 'fix/apt_repository_update_cache' of https://github.com/resmo/ansible into resmo-fix/apt_repository_update_cache 2013-09-18 12:40:39 -05:00
René Moser
cb9308a998 apt_repository: added option update_cache.
The default behavior is to update_cache if changed.

If you add more then one repo, you may not want to update cache for every repo separately.
So you can now disable update_cache with this new option e.g. update_cache=no

Updating cache can also be handled using the apt module.
2013-09-18 19:14:08 +02:00
René Moser
53d06b932a apt_repository: fix update cache after state=changed. Closes GH-4136 2013-09-18 11:47:39 +02:00
James Cammarata
a6e339fc36 Merge pull request #4138 from resmo/fix/redundant-fail-json
apt: fixed duplicate fail_json
2013-09-17 06:08:51 -07:00
Rene Moser
8c7c0833c2 apt: fixed duplicate fail_json 2013-09-17 15:05:20 +02:00
James Cammarata
d6b7c91aa9 Merge branch 'issue_3421_apt_pkg_iU' into devel 2013-09-16 06:54:05 -05:00
Michael DeHaan
4a50a76669 Merge pull request #4075 from sayap/easy_install
Locate easy_install path after (optionally) creating virtualenv.
2013-09-15 09:29:51 -07:00
James Cammarata
c48fc23d75 Use low-level package objects in the apt module to check installed state
Packages which are half-installed are not adequately represented by
the .is_installed field of the apt.package.Package object. By using the
lower-level apt_pkg.Package object (which provides the .current_state
field), we can check for a partially-installed state more accurately.

Fixes #3421
2013-09-11 23:33:59 -05:00
Hiroaki Nakamura
868620f7d0 Add an example for installing a group with the yum module. 2013-09-11 02:14:16 +09:00
Hiroaki Nakamura
80d68320f7 Fix to getchanged correctly for yum groupinstall. 2013-09-11 02:10:53 +09:00
Yap Sok Ann
6ca45d1964 Locate easy_install path after (optionally) creating virtualenv.
Without this, the first call to the easy_install module with a new virtualenv
will only create the virtualenv without installing the intended package, since
the `_is_package_installed` check will succeed as running /usr/bin/easy_install
as non-root user will return permission denied error with empty stdout.
2013-09-10 11:22:06 +08:00
James Cammarata
5a86b82cec Fixing typos in is_keyid function definition and usage
Fixes #4068
2013-09-09 17:26:44 -05:00
James Cammarata
ab21123a5c Revert "Styling: deprecation"
This reverts commit ecc2b6e742.

Fixes #4069
2013-09-09 15:17:43 -05:00
Michael DeHaan
789d08a85d Merge pull request #3942 from jocelynj/gem
Correctly handle option user_install in gem module
2013-08-27 06:00:06 -07:00
James Cammarata
25713f0b05 Minor text corrections in the yum module documentation 2013-08-24 21:46:41 -05:00
Jocelyn Jaubert
8b5d2aeef9 Correctly handle option user_install in gem module 2013-08-24 22:49:18 +02:00
Hiroaki Nakamura
949744c194 Add description and examples for the name parameter accepts a url or a local path to a rpm file. 2013-08-25 02:30:41 +09:00
James Cammarata
0caaa023e2 Cleaning up some pep8 issues in the pkgutil module 2013-08-22 20:21:02 -05:00
James Cammarata
fb23c53e3d Merge branch 'allow_wildcard_yum' of https://github.com/mscherer/ansible into mscherer-allow_wildcard_yum 2013-08-22 16:20:10 -05:00
James Cammarata
8345beafca Merge branch 'pacman_local_plus_check' of https://github.com/mivok/ansible into mivok-pacman_support_check_mode 2013-08-22 14:45:54 -05:00
James Cammarata
5c6276b6a3 Merge branch 'pacman_support_check_mode' of https://github.com/mivok/ansible into mivok-pacman_support_check_mode 2013-08-22 14:29:56 -05:00
James Cammarata
1f78606620 Minor doc fixes for the pkgutil module 2013-08-20 21:08:56 -05:00
Alexander Winkler
487dcccd7d Added module pkgutil 2013-08-20 21:08:56 -05:00
sjahl
39b0122d37 setting 0644 permissions on mkstemp file handles. Fixes issue #3857 2013-08-18 11:03:43 -04:00
Mark Harrison
2971215fd6 Merge branch 'pacman_local' into pacman_local_plus_check
Conflicts:
	library/packaging/pacman
2013-08-17 17:56:33 -04:00
Mark Harrison
832dd5e330 Support check mode with pacman module 2013-08-17 17:44:41 -04:00
Mark Harrison
3a702b100e Allow installation of local packages with pacman 2013-08-17 14:46:16 -04:00
Michael Scherer
df682d1cda Allow to use '*test*' in enablerepo for yum action
Yum commandline permit to use a wildcard to enable and disable
repositories in the --enablerepo switch, permitting to enable
a complete set of repository at once ( like all rpmfusion, all
update-testing, etc ).

However, this doesn't work in yum due to more stringent checks
that verify that a exact match is given for the name of the
repository , see commit 5c26805.

This commit enhance the check by permitting to test more than
1 repository at a time, thus permitting to use wildcards.
2013-08-17 18:43:53 +02:00
James Cammarata
a32f1cac8d Cleaning up of apt_repository module and removing wget parts 2013-08-13 16:11:03 -05:00
Michael Vogt
d036723661 use either pycurl or wget to download from launchpad, also improve error message if neither is installed 2013-08-13 14:39:47 -05:00
Michael Vogt
b69e7c92e7 use pycurl instead of urllib2 when talking to launchpad to actually get SSL cert verification, see https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/915210 or CVE-2011-4407 for a previous similar issue in software-properties 2013-08-13 14:39:47 -05:00
James Cammarata
ae962bf645 Reverting version_added field in the apt_repository module 2013-08-13 09:53:49 -05:00
Alexander Saltanov
aed1f4156e Replacement for apt_repository.
1. Debian Squeeze is supported out of box now.
2. Repository type "deb" or "deb-src" should be explicitly specified.
3. If a source had beed added it must be possible to remove it.
4. PPA can be only used against Ubuntu hosts.
2013-08-13 09:53:49 -05:00
James Cammarata
93a9b1c5c6 Fail apt package install when nothing is matched by the fnmatch pattern
Related to PR #3823
2013-08-12 11:26:31 -05:00
Michael Vogt
2503c36c6a add support for fnmatch() style apt filenames
You can write a apt action like "- apt: pkg=apt*" with this package.
2013-08-12 16:11:15 +02:00
Abhijit Menon-Sen
a37e232cb1 Fix some typos discovered during casual reading 2013-08-11 18:41:23 +05:30
Alan Grosskurth
d91e6e06e4 apt: Run remove commands noninteractively
I'm seeing ansible hang when trying to remove a package, and the hung
process is `whiptail` like in #2763. It looks like we only use
`APT_ENVVARS` and `DPKG_OPTIONS` for the `apt` commands in install()
and upgrade(). This change uses them in remove() as well, which fixes
the hang.
2013-08-05 15:20:45 -07:00
Michael DeHaan
ea08f247f9 PEP8: fix spacing 2013-08-03 14:55:38 -04:00
Michael DeHaan
1e2630d814 Merge pull request #3718 from hacosta/rpm_key
Add rpm_key module
2013-08-03 11:39:10 -07:00
Michael DeHaan
c13b1cb18e Rename option to 'recurse' to make it consistent. Add version_added to docs. 2013-08-03 14:27:11 -04:00
Michael DeHaan
933455a6a3 Merge pull request #3636 from uggedal/pacman-remove-recursive
Pacman module: recursive remove support
2013-08-03 11:26:15 -07:00
Michael DeHaan
e1e37002c3 Add version_added to new parameter. 2013-08-03 14:22:38 -04:00
Michael DeHaan
d6b54d69fd Merge pull request #3662 from grosskur/apt-key-keyring-param
apt_key: Add 'keyring' parameter
2013-08-03 11:21:52 -07:00
Hector Acosta
809278ba1b Add rpm_key module
This module can be used to import public keys into your rpm database.

Signed-off-by: Hector Acosta <hector.acosta@gmail.com>
2013-07-31 15:55:38 -05:00
Alan Grosskurth
5700970e05 apt_key: Add 'keyring' parameter
The apt-key command takes an optional --keyring parameter representing
the path to a specific GPG keyring to operate on. If it's not given,
the command operates on all keyring files, i.e., /etc/apt/trusted.gpg
and /etc/apt/trusted.gpg.d/*.gpg.

This change adds a 'keyring' parameter to the apt_key module and
propagates it down to the apt-key command line. The main use case this
supports is organizing keys for third-party repos into individual
keyrings in /etc/apt/trusted.gpg.d, rather than putting them all in
the default keyring.
2013-07-24 18:10:17 -07:00
Andreas Kaiser
1bf6656f0b Fix pkgin search (yielding wrong results under certain conditions, see inline comments). 2013-07-24 16:18:14 +02:00
Eivind Uggedal
16cb5551af Pacman module: recursive remove support 2013-07-23 15:01:13 +02:00
Michael DeHaan
7bfc24706c Fix prev feature commit, Do not require aptitude to use apt commands in the apt module, only needed when upgrading. 2013-07-22 15:15:55 -04:00
Michael DeHaan
adda77a42b Merge pull request #3617 from dermute/devel
svr4pkg doesn't work on Sol10
2013-07-22 04:37:10 -07:00
Michael DeHaan
dc7e280d3b Update docs to add version_added attribute. 2013-07-21 11:12:04 -04:00
Michael DeHaan
8065e414d1 Merge pull request #3400 from diko4096/patch-1
Update gem
2013-07-21 08:10:27 -07:00
Michael DeHaan
6030c1bcaa tweak indentation for 'make pep8' 2013-07-20 12:48:11 -04:00
Patrik Lundin
b9b8f90d91 openbsd_pkg: Use ansible run_command().
This fixes an asterisk glob problem in get_package_state() where a file
in /root/ could cause shell expansion if it matched the package name.
The actual problem is solved by running with shell=False.
2013-07-20 17:45:07 +02:00
Michael DeHaan
a58d827d72 Merge pull request #3379 from serenecloud/devel
Return a friendly error message if aptitude isn't installed
2013-07-19 07:36:39 -07:00
Michael DeHaan
732d3eb8bd Merge pull request #3493 from eest/openbsd_pkg-fixes
openbsd_pkg corner case fixes
2013-07-19 07:30:18 -07:00
Michael DeHaan
669a65922c Merge pull request #3515 from neomantra/apt_repository
apt_repository: enhance documentation
2013-07-19 07:06:05 -07:00
Alexander Winkler
1e99f81c78 fixes ansible/ansible#3547 2013-07-16 09:17:57 +02:00
Michael DeHaan
5603c32929 Fixing your YAML Seth :) 2013-07-15 13:16:37 -04:00
Seth Vidal
915d8e1847 add examples for yum: state=latest name=* 2013-07-13 14:29:04 -04:00
Seth Vidal
de7d291d1e add a '*' option for name to state=latest to do a global update 2013-07-13 14:28:52 -04:00
Evan Wies
5fcf10a3ca apt_repository: enhance documentation 2013-07-12 15:03:37 -04:00
Patrik Lundin
5f53229de2 openbsd_pkg: some whitespace cleanup. 2013-07-10 21:23:10 +02:00
Patrik Lundin
023711bb2c openbsd_pkg: sync package_latest().
This diff syncs package_latest() with the changes to package_present().
I have not managed to figure out how to handle the cornercases where
stderr is set but the command has not failed, so leave a FIXME blob for
other adventurers.
2013-07-10 21:06:35 +02:00
Patrik Lundin
8646df0a1f openbsd_pkg: Handle another pkg_add gotcha
* Add '-m' to pkg_add incovation to get access to the "packagename-1.0: ok"
  message.
* Watch for that message if we are about to fail because of stderr in
  package_present().
2013-07-10 18:19:01 +02:00
Patrik Lundin
72d73bcc70 openbsd_pkg: handle pkg_add quirks better.
This fixes a problem when trying to install a package with a specific version
number from a local directory and the local directory is checked after a remote
repository:

Error from http://ftp.eu.openbsd.org/pub/OpenBSD/[...]/packagename-1.0.tgz
ftp: Error retrieving file: 404 Not Found
packagename-1.0: ok
2013-07-09 20:56:22 +02:00
Felix Stuermer
ed7b073550 Use the force=yes option for apt upgrade actions 2013-07-09 10:57:19 +02:00
Seth Vidal
537166b1ea - optimize for the extremely common case of people specifying pkg names which are, ultimately, already installed
on a system here time went from  16s for a series of pkgs to 3s to just
  check that they were installed.
2013-07-04 17:35:34 -04:00
Dmitry Kolobaev
796e68d15a Update gem
I've added ability to install gems in system-wide manner with --no-user-install options
2013-07-01 06:20:46 -07:00
Michael DeHaan
ca2c28413a Styling: deprecation 2013-06-30 18:55:45 -04:00
Michael DeHaan
7dd8c2dda4 Styling: misc pep8 2013-06-30 18:54:32 -04:00
serenecloud
e6601b669e Return a friendly error message if aptitude isn't installed 2013-06-30 15:36:13 +12:00
Jack Kuan
94d1a2542e Fix the issue of easy_install ignoring virtualenv_site_packages=yes. 2013-06-29 17:03:12 -04:00
Michael DeHaan
3dc560a1a2 Fixup previous apt_key patch to enable file based modes to work. 2013-06-26 14:46:29 -04:00
James Laska
ab745fa0b6 Correctly load up2date configuration
Previously, a configuration file name of None was being passed into
up2dateInitConfig().  This resulted in a correct configuration import,
but failed to properly save the configuration back to disk in the event
a different serverURL was supplied.  This change removes support for
customizing the up2date filename entirely, and relies on up2date to
choose the default config filename.
2013-06-24 13:00:23 -04:00
Michael DeHaan
531e290033 Merge branch 'PR_add_chdir_to_pip' of git://github.com/y-p/ansible into devel
Conflicts:
	library/packaging/pip
2013-06-19 22:30:44 -04:00
Michael DeHaan
fe871ecfd4 Merge branch 'fix-apt-purge' of git://github.com/madduck/ansible into purge 2013-06-19 21:35:28 -04:00
Michael DeHaan
79a9629108 Revert "now modules can implement with_items list globbing w/o updating"
This reverts commit 4942a06bc2.

Conflicts:

	lib/ansible/runner/__init__.py
2013-06-19 19:00:18 -04:00
martin f. krafft
a52f531c5b Always assume purged for older python-apt
Older python-apt modules don't export Package.installed_files and there
seems to be no other way to figure out if a package is
removed-but-not-purged, so we just always assume it's purged.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-19 10:56:43 +02:00
martin f. krafft
3d1db80fe0 Introduce non-purged package status
A package may be removed but not purged with APT. The only way to
identify this state is by looking at the list of installed files of
a package. Even if the package has no files installed, this list will be
non-empty until the package is removed:

  # python -c "import apt; c=apt.Cache(); c.update(); c.open(); p=c['ruby1.8']; print p, p.installed, p.installed_files"
  <Package: name:'ruby1.8' id:1425> None [u'']

  # dpkg --purge ruby1.8
  (Reading database ... 27904 files and directories currently installed.)
  Removing ruby1.8 ...
  Purging configuration files for ruby1.8 ...

  # python -c "import apt; c=apt.Cache(); c.update(); c.open(); p=c['ruby1.8']; print p, p.installed, p.installed_files"
  <Package: name:'ruby1.8' id:1425> None []

See http://bugs.debian.org/712749 too.

If a package is not marked installed but it still 'has_files', then it
should be processed if the request is to purge it.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-19 10:00:33 +02:00
martin f. krafft
1bf4438e60 Fix purging of packages
A small error in the reuse of a variable caused packages to never get
purged. This commit fixes that.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-19 10:00:33 +02:00
Michael DeHaan
03f1578768 Merge conflict 2013-06-18 20:18:17 -04:00
Michael DeHaan
69ff91505c Merge remote branch 'origin/devel' into devel 2013-06-18 20:17:31 -04:00
Jesse Keating
9f3c43290e pkg option of apt is not required
You can use apt module with update_cache and without specifying a
package. Update the docs to reflect this.
2013-06-18 16:25:46 -07:00
Michael DeHaan
538a998d26 Merge branch 'apt_key_file' of git://github.com/veeti/ansible into devel
Conflicts:
	library/packaging/apt_key
2013-06-18 16:18:31 -04:00
Veeti Paananen
b53982f9d2 Add apt_key examples for file and data 2013-06-17 18:23:40 +03:00
Jan-Piet Mens
98c1423269 Docs: consistently format playbook EXAMPLES 2013-06-17 08:53:46 +02:00
Michael DeHaan
d91ffdef72 Merge pull request #3162 from strawlab/apt-key-binary-fix
allow apt-key module to work with binary key
2013-06-16 20:27:10 -07:00
Michael DeHaan
e27e8d91ac Merge pull request #3225 from eest/openbsd_pkg-check_mode
openbsd_pkg: Add check_mode support.
2013-06-16 19:40:46 -07:00
Michael DeHaan
3a9f45d457 Merge pull request #3213 from veeti/apt_key_data
Document the data argument for apt_key
2013-06-16 19:39:55 -07:00
Michael DeHaan
2ec0c4478c Merge pull request #3227 from bcoca/modules_wantlist
implementing with_items list globbing made easier for modules
2013-06-16 19:29:02 -07:00
Michael DeHaan
2ad98dec1c Merge pull request #3199 from chrishoffman/doc_error
Fixing documentation error
2013-06-16 19:28:12 -07:00
Michael DeHaan
275b0d6c4e Merge pull request #3194 from E-M/patch-2
Fixed Issue #3193 - make rhn_register module compatible with EL 5
2013-06-16 19:17:05 -07:00
Brian Coca
98c290f9e1 now modules can implement with_items list globbing w/o updating
hardcoded lists in ansible code, just add WITH_ITEMS_USES_LIST in a
comment anywhere, and of course, support recieving params as list.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-06-15 16:28:43 -04:00
Jan-Piet Mens
3404a0fc16 DOCS: standardize on EXAMPLES (a.k.a. Docs-JumboPatch JetLag Edition)
Migrated all examples: in DOCUMENTATION=''' string to standalone EXAMPLES=''' string
  Added deprecation warning to moduledev.rst and remove deprecated example from it
  Fixed up a few typos and uppercased some acronyms.
  add consistency to how EXAMPLES are formatted
2013-06-15 20:54:25 +02:00