On this page
bundler - Manage Ruby Gem dependencies with Bundler
New in version 2.0.0.
Synopsis
- Manage installation and Gem version dependencies for Ruby using the Bundler gem
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| binstub_directory | 
        
        Only applies if state is  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 chdir is set then this path is relative to chdir
        | 
     |
| chdir | Default: 
        "temporary working directory"
         | 
      
        
        The directory to execute the bundler commands from. This directoy needs to contain a valid Gemfile or .bundle/ directory
         | 
     
| clean  
        bool
         | 
      
       
  | 
      
        
        Only applies if state is  present. If set removes any gems on the target host that are not in the gemfile
        | 
     
| deployment_mode  
        bool
         | 
      
       
  | 
      
        
        Only applies if state is  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
        | 
     
| exclude_groups | 
        
        A list of Gemfile groups to exclude during operations. This only applies when state is  present. Bundler considers this a 'remembered' property for the Gemfile and will automatically exclude groups in future operations even if exclude_groups is not set
        | 
     |
| executable | 
        
        The path to the bundler executable
         | 
     |
| extra_args | 
        
        A space separated string of additional commands that can be applied to the Bundler command. Refer to the Bundler documentation for more information
         | 
     |
| gem_path | Default: 
        "RubyGems gem paths"
         | 
      
        
        Only applies if state is  present. Specifies the directory to install the gems into. If chdir is set then this path is relative to chdir
        | 
     
| gemfile | Default: 
        "Gemfile in current directory"
         | 
      
        
        Only applies if state is  present. The path to the gemfile to use to install gems.
        | 
     
| local  
        bool
         | 
      
       
  | 
      
        
        If set only installs gems from the cache on the target host
         | 
     
| state | 
       
  | 
      
        
        The desired state of the Gem bundle.  latest updates gems to the most recent, acceptable version
        | 
     
| user_install  
        bool
         | 
      
       
  | 
      
        
        Only applies if state is  present. Installs gems in the local user's cache or for all users
        | 
     
Examples
# Installs gems from a Gemfile in the current directory
- bundler:
    state: present
    executable: ~/.rvm/gems/2.1.5/bin/bundle
# Excludes the production group from installing
- bundler:
    state: present
    exclude_groups: production
# Only install gems from the default and production groups
- bundler:
    state: present
    deployment_mode: yes
# Installs gems using a Gemfile in another directory
- bundler:
    state: present
    gemfile: ../rails_project/Gemfile
# Updates Gemfile in another directory
- bundler:
    state: latest
    chdir: ~/rails_project
  Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Tim Hoiberg (@thoiberg)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/bundler_module.html