community.general.gem (8.5.0) — module

Manage Ruby gems

Authors: Ansible Core Team, Johan Wiren (@johanwiren)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage installation and uninstallation of Ruby gems.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install version 1.0 of vagrant
  community.general.gem:
    name: vagrant
    version: 1.0
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install latest available version of rake
  community.general.gem:
    name: rake
    state: latest
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - The name of the gem to be managed.
    required: true
    type: str

norc:
    default: true
    description:
    - Avoid loading any C(.gemrc) file. Ignored for RubyGems prior to 2.5.2.
    - The default changed from V(false) to V(true) in community.general 6.0.0.
    type: bool
    version_added: 3.3.0
    version_added_collection: community.general

force:
    default: false
    description:
    - Force gem to (un-)install, bypassing dependency checks.
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    - latest
    default: present
    description:
    - The desired state of the gem. V(latest) ensures that the latest version is installed.
    required: false
    type: str

bindir:
    description:
    - Install executables into a specific directory.
    type: path
    version_added: 3.3.0
    version_added_collection: community.general

version:
    description:
    - Version of the gem to be installed/removed.
    required: false
    type: str

executable:
    description:
    - Override the path to the gem executable
    required: false
    type: path

gem_source:
    description:
    - The path to a local gem used as installation source.
    required: false
    type: path

repository:
    aliases:
    - source
    description:
    - The repository from which the gem will be installed
    required: false
    type: str

build_flags:
    description:
    - Allow adding build flags for gem compilation
    required: false
    type: str

env_shebang:
    default: false
    description:
    - Rewrite the shebang line on installed scripts to use /usr/bin/env.
    required: false
    type: bool

include_doc:
    default: false
    description:
    - Install with or without docs.
    required: false
    type: bool

install_dir:
    description:
    - 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.
    required: false
    type: path

pre_release:
    default: false
    description:
    - Allow installation of pre-release versions of the gem.
    required: false
    type: bool

user_install:
    default: true
    description:
    - Install gem in user's local gems cache or for all users
    required: false
    type: bool

include_dependencies:
    default: true
    description:
    - Whether to include dependencies or not.
    required: false
    type: bool