ansible.builtin.bundler (v2.4.2.0-1) — 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.4.2.0.post1

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.
# Only install gems from the default and production groups
- 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 directoy needs to contain
      a valid Gemfile or .bundle/ directory
    required: false

clean:
    choices:
    - true
    - false
    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
    required: false

local:
    choices:
    - true
    - false
    default: 'no'
    description:
    - If set only installs gems from the cache on the target host
    required: false

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

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

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)
    required: false

executable:
    default: null
    description:
    - The path to the bundler executable
    required: false

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

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

exclude_groups:
    default: null
    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
    required: false

deployment_mode:
    choices:
    - true
    - false
    default: 'no'
    description:
    - Only applies if state is C(present). If set it will only install gems that are in
      the default or production groups. Requires a Gemfile.lock file to have been created
      prior
    required: false

binstub_directory:
    default: null
    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)
    required: false