W3cubDocs

/Ansible

community.general.gem – Manage Ruby gems

Note

This plugin is part of the community.general collection (version 3.8.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.gem.

Synopsis

  • Manage installation and uninstallation of Ruby gems.

Parameters

Parameter Choices/Defaults Comments
bindir
path
added in 3.3.0 of community.general
Install executables into a specific directory.
build_flags
string
Allow adding build flags for gem compilation
env_shebang
boolean
    Choices:
  • no
  • yes
Rewrite the shebang line on installed scripts to use /usr/bin/env.
executable
path
Override the path to the gem executable
force
boolean
    Choices:
  • no
  • yes
Force gem to install, bypassing dependency checks.
gem_source
path
The path to a local gem used as installation source.
include_dependencies
boolean
    Choices:
  • no
  • yes
Whether to include dependencies or not.
include_doc
boolean
    Choices:
  • no
  • yes
Install with or without docs.
install_dir
path
Install the gems into a specific directory. These gems will be independent from the global installed ones. Specifying this requires user_install to be false.
name
string / required
The name of the gem to be managed.
norc
boolean
added in 3.3.0 of community.general
    Choices:
  • no
  • yes
Avoid loading any .gemrc file. Ignored for RubyGems prior to 2.5.2.
The current default value will be deprecated in community.general 4.0.0: if the value is not explicitly specified, a deprecation message will be shown.
From community.general 5.0.0 on, the default will be changed to true.
pre_release
boolean
    Choices:
  • no
  • yes
Allow installation of pre-release versions of the gem.
repository
string
The repository from which the gem will be installed

aliases: source
state
string
    Choices:
  • present
  • absent
  • latest
The desired state of the gem. latest ensures that the latest version is installed.
user_install
boolean
    Choices:
  • no
  • yes
Install gem in user's local gems cache or for all users
version
string
Version of the gem to be installed/removed.

Examples

- name: Install version 1.0 of vagrant
  community.general.gem:
    name: vagrant
    version: 1.0
    state: present

- name: Install latest available version of rake
  community.general.gem:
    name: rake
    state: latest

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

Authors

  • Ansible Core Team
  • Johan Wiren (@johanwiren)

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