Redmineインストール時にgemパッケージのインストールで失敗

# Redmineインストール時にgemパッケージのインストールで失敗
Ansibleを使ってRedmineを自動インストールしようとした際に、gemパッケージのインストールで失敗した。
参考: https://github.com/farend/redmine-centos-ansible

## 環境
| ソフトウェア |    バージョン     |
| ------------ | ----------------- |
| OS           | CentOS 7.6        |
| Redmine      | Redmine 3.4.7     |
| データベース | PostgreSQL 9.2.24 |
| Webサーバ    | Apache 2.4.6      |
| Ruby         | 2.4.1             |

# Playbookの実行時に失敗
```
# ansible-playbook -i hosts site.yml

(省略)

TASK [redmine : gemsパッケージのインストール] ********************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bundle", "install", "--path", "vendor/bundle"], "delta": "0:00:05.150492", "end": "2019-01-09 11:46:59.522686", "msg": "non-zero return code", "rc": 6, "start": "2019-01-09 11:46:54.372194", "stderr": "Don't run Bundler as root. Bundler can ask for sudo if it is needed, and\ninstalling your bundle as root will break this application for all non-root\nusers on this machine.\nThe dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.\nBundler could not find compatible versions for gem \"bundler\":\n  In Gemfile:\n    rails (= 4.2.11) was resolved to 4.2.11, which depends on\n      bundler (>= 1.3.0, < 2.0)\n\n  Current Bundler version:\n    bundler (2.0.1)\nThis Gemfile requires a different version of Bundler.\nPerhaps you need to update Bundler by running `gem install bundler`?\n\nCould not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails\n(= 4.2.11)', in any of the sources.\n\nBundler could not find compatible versions for gem \"nokogiri\":\n  In Gemfile:\n    nokogiri (~> 1.8.1)\n\n    capybara (~> 2.13) was resolved to 2.18.0, which depends on\n      nokogiri (>= 1.3.3)\n\n    rails-dom-testing was resolved to 2.0.3, which depends on\n      nokogiri (>= 1.6)\n\n    roadie (~> 3.2.1) was resolved to 3.2.2, which depends on\n      nokogiri (~> 1.5)", "stderr_lines": ["Don't run Bundler as root. Bundler can ask for sudo if it is needed, and", "installing your bundle as root will break this application for all non-root", "users on this machine.", "The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.", "Bundler could not find compatible versions for gem \"bundler\":", "  In Gemfile:", "    rails (= 4.2.11) was resolved to 4.2.11, which depends on", "      bundler (>= 1.3.0, < 2.0)", "", "  Current Bundler version:", "    bundler (2.0.1)", "This Gemfile requires a different version of Bundler.", "Perhaps you need to update Bundler by running `gem install bundler`?", "", "Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails", "(= 4.2.11)', in any of the sources.", "", "Bundler could not find compatible versions for gem \"nokogiri\":", "  In Gemfile:", "    nokogiri (~> 1.8.1)", "", "    capybara (~> 2.13) was resolved to 2.18.0, which depends on", "      nokogiri (>= 1.3.3)", "", "    rails-dom-testing was resolved to 2.0.3, which depends on", "      nokogiri (>= 1.6)", "", "    roadie (~> 3.2.1) was resolved to 3.2.2, which depends on", "      nokogiri (~> 1.5)"], "stdout": "Fetching gem metadata from https://rubygems.org/..........\nFetching gem metadata from https://rubygems.org/.\nResolving dependencies...", "stdout_lines": ["Fetching gem metadata from https://rubygems.org/..........", "Fetching gem metadata from https://rubygems.org/.", "Resolving dependencies..."]}
        to retry, use: --limit @/root/redmine-centos-ansible/site.retry
```

# gemパッケージのインストールのみを再実行してみる

```
# cd /var/lib/redmine/
# bundle install --without development test --path vendor/bundle
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break
this application for all non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2.11) was resolved to 4.2.11, which depends on
      bundler (>= 1.3.0, < 2.0)

  Current Bundler version:
    bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2.11)', in any of the
sources.

Bundler could not find compatible versions for gem "nokogiri":
  In Gemfile:
    nokogiri (~> 1.8.1)

    capybara (~> 2.13) was resolved to 2.18.0, which depends on
      nokogiri (>= 1.3.3)

    rails-dom-testing was resolved to 2.0.3, which depends on
      nokogiri (>= 1.6)

    roadie (~> 3.2.1) was resolved to 3.2.2, which depends on
      nokogiri (~> 1.5)
```

bundlerのバージョンが1.3.0 ～ 2.0でないとダメっぽい？

# `gem list`コマンドでインストールされているgemパッケージの確認

```
# gem list

*** LOCAL GEMS ***

bigdecimal (1.4.2, default: 1.3.0)
bundler (2.0.1, default: 1.17.3)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (2.1.0, default: 2.0.2)
minitest (5.11.3, 5.10.1)
net-telnet (0.2.0, 0.1.1)
openssl (2.1.2, default: 2.0.3)
power_assert (1.1.3, 0.4.1)
psych (3.1.0, default: 2.2.2)
rake (12.3.2, 12.0.0)
rdoc (6.1.1, default: 5.0.0)
rubygems-update (3.0.2, 2.6.11)
test-unit (3.2.9, 3.2.3)
xmlrpc (0.3.0, 0.2.1)

```

bundler 2.0.1がインストール済み

# bundler 2.0.1をアンインストール
```
gem uninstall -v 2.0.1 bundler
```

```
# gem list

*** LOCAL GEMS ***

bigdecimal (1.4.2, default: 1.3.0)
bundler (default: 1.17.3)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (2.1.0, default: 2.0.2)
minitest (5.11.3, 5.10.1)
net-telnet (0.2.0, 0.1.1)
openssl (2.1.2, default: 2.0.3)
power_assert (1.1.3, 0.4.1)
psych (3.1.0, default: 2.2.2)
rake (12.3.2, 12.0.0)
rdoc (6.1.1, default: 5.0.0)
rubygems-update (3.0.2, 2.6.11)
test-unit (3.2.9, 3.2.3)
xmlrpc (0.3.0, 0.2.1)
```

# gemパッケージのインストールを再実行
```
bundle install --without development test --path vendor/bundle
```
**⇒ 上手くいった**