gem - Manage Ruby gems

Synopsis

  • Manage installation and uninstallation of Ruby gems.

Parameters

Parameter Choices/Defaults Comments
build_flags
(added in 2.0)
Allow adding build flags for gem compilation
env_shebang
(added in 2.2)
Default:
no
Rewrite the shebang line on installed scripts to use /usr/bin/env.
executable
(added in 1.4)
Override the path to the gem executable
gem_source
The path to a local gem used as installation source.
include_dependencies
    Choices:
  • yes
  • no
Whether to include dependencies or not.
include_doc
(added in 2.0)
Default:
no
Install with or without docs.
name
required
The name of the gem to be managed.
pre_release
(added in 1.6)
Default:
no
Allow installation of pre-release versions of the gem.
repository
The repository from which the gem will be installed

aliases: source
state
    Choices:
  • present
  • absent
  • latest
The desired state of the gem. latest ensures that the latest version is installed.
user_install
(added in 1.3)
    Choices:
  • yes
  • no
Install gem in user's local gems cache or for all users
version
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.

Author

  • Ansible Core Team
  • Johan Wiren

Hint

If you notice any issues in this documentation you can edit this document to improve it.

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