community.general icon indicating copy to clipboard operation
community.general copied to clipboard

community.general.bundler

Open amg-web opened this issue 3 years ago • 8 comments

Summary

when I run:

- name: install gems
  community.general.bundler:
      state: present
      chdir: /home/user/public_html
      user_install: yes
      deployment_mode: true
      exclude_groups:
          - development 
          - test

I get deprication worning and playbook stops. if I replace deployment_mode: true with gem_path: vendor/bundle it passes

Issue Type

Bug Report

Component Name

bundler

Ansible Version

$ ansible --version
ansible [core 2.12.4]
  config file = None
  configured module search path = ['/home/anmg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/anmg/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/anmg/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/anmg/.local/bin/ansible
  python version = 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
  jinja version = 3.1.1
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
community.general 4.7.0 

Configuration

$ ansible-config dump --only-changed

empty response for this command

OS / Environment

Ubuntu 20.04

Steps to Reproduce

- name: install gems
  community.general.bundler:
      state: present
      chdir: /home/user/public_html
      user_install: yes
      deployment_mode: true
      exclude_groups:
          - development 
          - test

Expected Results

expect playbook running successfully ^)

Actual Results

[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'development:test'`, and stop using this flag

gem env output: ` gem env RubyGems Environment:

  • RUBYGEMS VERSION: 3.1.6
  • RUBY VERSION: 2.7.5 (2021-11-24 patchlevel 203) [x86_64-linux-gnu]
  • INSTALLATION DIRECTORY: /var/lib/gems/2.7.0
  • USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.7.0
  • RUBY EXECUTABLE: /usr/bin/ruby2.7
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • SPEC CACHE DIRECTORY: /root/.gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /var/lib/gems/2.7.0
    • /root/.gem/ruby/2.7.0
    • /usr/lib/ruby/gems/2.7.0
    • /usr/share/rubygems-integration/2.7.0
    • /usr/share/rubygems-integration/all
    • /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
    • https://rubygems.org/
  • SHELL PATH:
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
    • /sbin
    • /bin
    • /usr/games
    • /usr/local/games
    • /snap/bin `

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

amg-web avatar Apr 27 '22 12:04 amg-web

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Apr 27 '22 12:04 ansibullbot

cc @evrardjp @thoiberg click here for bot help

ansibullbot avatar Apr 27 '22 12:04 ansibullbot

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Apr 27 '22 12:04 ansibullbot

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Nov 05 '22 17:11 ansibullbot

To remove the deprecation warnings, environment variables can be used to set the bundler config options:

 - name: install gems
   community.general.bundler:
       state: present
       chdir: /home/user/public_html
       user_install: yes
-      deployment_mode: true
-      exclude_groups:
-          - development 
-          - test
+  environment:
+      BUNDLE_DEPLOYMENT: "true"
+      BUNDLE_WITHOUT: "development:test"

alexsanderson avatar Feb 01 '23 09:02 alexsanderson

Shouldn't environment be one level up (task level instead of module args level)?

felixfontein avatar Feb 03 '23 09:02 felixfontein

Yes @felixfontein, good catch! Thanks. I've edited/fixed the block.

alexsanderson avatar Feb 03 '23 12:02 alexsanderson

well the issue is till there

bundler version 2.5+

i use from module manual

- name: Install gems into ./vendor/bundle
  community.general.bundler:
    state: present
    deployment_mode: true

and got error

[DEPRECATED] The --deployment flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use bundle config set deployment true, and stop using this flag

remove deployment_mode I get this:

"The bundle is locked, but Gemfile.rails71.plugins.lock is missing. Please make sure you have checked Gemfile.rails71.plugins.lock into version control before deploying"

To install my project manually I use following:

bundle config set path 'vendor/bundle'

it creates config file in project folder .bundle/config

then simply run bundle install

we need to check bundler version and use bundler keys depending on version.

in past it was ok to use: bundle install --path vendor/bundle

amg-web avatar Aug 27 '24 09:08 amg-web