community.general.bundler (8.5.0) — module

Manage Ruby Gem dependencies with Bundler

Authors: Tim Hoiberg (@thoiberg)

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 Gem version dependencies for Ruby using the Bundler gem

Usage examples

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

Inputs

    
chdir:
    description:
    - The directory to execute the bundler commands from. This directory needs to contain
      a valid Gemfile or .bundle/ directory
    - If not specified, it will default to the temporary working directory
    type: path

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

local:
    default: false
    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. V(latest) updates gems to the most recent,
      acceptable version
    type: str

gemfile:
    description:
    - Only applies if O(state=present). The path to the gemfile to use to install gems.
    - If not specified it will default to the Gemfile in current directory
    type: path

gem_path:
    description:
    - Only applies if O(state=present). Specifies the directory to install the gems into.
      If O(chdir) is set then this path is relative to O(chdir)
    - If not specified the default RubyGems gem paths will be used.
    type: path

executable:
    description:
    - The path to the bundler executable
    type: str

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
    type: str

user_install:
    default: true
    description:
    - Only applies if O(state=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 O(state=present).
      Bundler considers this a 'remembered' property for the Gemfile and will automatically
      exclude groups in future operations even if O(exclude_groups) is not set
    elements: str
    type: list

deployment_mode:
    default: false
    description:
    - Only applies if O(state=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 O(state=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 O(chdir) is set
      then this path is relative to O(chdir)
    type: path