ansible.builtin.bundler (v2.9.27) — module

Manage Ruby Gem dependencies with Bundler

| "added in version" 2.0.0 of ansible.builtin"

Authors: Tim Hoiberg (@thoiberg)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manage installation and Gem version dependencies for Ruby using the Bundler gem

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Installs gems from a Gemfile in the current directory
- bundler:
    state: present
    executable: ~/.rvm/gems/2.1.5/bin/bundle
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Excludes the production group from installing
- bundler:
    state: present
    exclude_groups: production
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install gems into ./vendor/bundle
- bundler:
    state: present
    deployment_mode: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Installs gems using a Gemfile in another directory
- bundler:
    state: present
    gemfile: ../rails_project/Gemfile
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Updates Gemfile in another directory
- bundler:
    state: latest
    chdir: ~/rails_project

Inputs

    
chdir:
    default: temporary working directory
    description:
    - The directory to execute the bundler commands from. This directory needs to contain
      a valid Gemfile or .bundle/ directory

clean:
    default: 'no'
    description:
    - Only applies if state is C(present). If set removes any gems on the target host
      that are not in the gemfile
    type: bool

local:
    default: 'no'
    description:
    - If set only installs gems from the cache on the target host
    type: bool

state:
    choices:
    - present
    - latest
    default: present
    description:
    - The desired state of the Gem bundle. C(latest) updates gems to the most recent,
      acceptable version

gemfile:
    default: Gemfile in current directory
    description:
    - Only applies if state is C(present). The path to the gemfile to use to install gems.

gem_path:
    default: RubyGems gem paths
    description:
    - Only applies if state is C(present). Specifies the directory to install the gems
      into. If C(chdir) is set then this path is relative to C(chdir)

executable:
    description:
    - The path to the bundler executable

extra_args:
    description:
    - A space separated string of additional commands that can be applied to the Bundler
      command. Refer to the Bundler documentation for more information

user_install:
    default: 'yes'
    description:
    - Only applies if state is C(present). Installs gems in the local user's cache or
      for all users
    type: bool

exclude_groups:
    description:
    - A list of Gemfile groups to exclude during operations. This only applies when state
      is C(present). Bundler considers this a 'remembered' property for the Gemfile and
      will automatically exclude groups in future operations even if C(exclude_groups)
      is not set

deployment_mode:
    default: 'no'
    description:
    - Only applies if state is C(present). If set it will install gems in ./vendor/bundle
      instead of the default location. Requires a Gemfile.lock file to have been created
      prior
    type: bool

binstub_directory:
    description:
    - Only applies if state is C(present). Specifies the directory to install any gem
      bins files to. When executed the bin files will run within the context of the Gemfile
      and fail if any required gem dependencies are not installed. If C(chdir) is set
      then this path is relative to C(chdir)