W3cubDocs

/Ansible

gem - Manage Ruby gems

Synopsis

  • Manage installation and uninstallation of Ruby gems.

Options

parameter required default choices comments
build_flags
(added in 2.0)
no
Allow adding build flags for gem compilation
env_shebang
(added in 2.2)
no no
Rewrite the shebang line on installed scripts to use /usr/bin/env.
executable
(added in 1.4)
no
Override the path to the gem executable
gem_source
no
The path to a local gem used as installation source.
include_dependencies
no yes
  • yes
  • no
Whether to include dependencies or not.
include_doc
(added in 2.0)
no no
Install with or without docs.
name
yes
The name of the gem to be managed.
pre_release
(added in 1.6)
no no
Allow installation of pre-release versions of the gem.
repository
no
The repository from which the gem will be installed
aliases: source
state
no present
  • present
  • absent
  • latest
The desired state of the gem. latest ensures that the latest version is installed.
user_install
(added in 1.3)
no yes
  • yes
  • no
Install gem in user's local gems cache or for all users
version
no
Version of the gem to be installed/removed.

Examples

# Installs version 1.0 of vagrant.
- gem:
    name: vagrant
    version: 1.0
    state: present

# Installs latest available version of rake.
- gem:
    name: rake
    state: latest

# Installs rake version 1.0 from a local gem on disk.
- gem:
    name: rake
    gem_source: /path/to/gems/rake-1.0.gem
    state: present

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/gem_module.html