default eye-catch image.

vagrant(ubuntu/xenial64 vbox) ubuntu16にrbenv rubyをインストールするplaybook (ほぼ失敗作)

作ってみたがrbenv installにとても時間がかかるので現実的ではないと思う。 vagrantのように壊して作るのが前提ならrbenvでバージョンを切り替えられる必要はないから、 わざわざ毎回コンパイルすることはない気がする。 いずれapt-get installで直接インストールする方法を試してみる。 commonロール 実験の結果、ubuntu/xenial64 vboxに必要だったパッケージたちを入れるロール。 become: yes, become_method: sudo で実行。 --- - name: install packages apt: name=\"{{item}}\" state=present with_items: - gcc - make - libssl-dev - zlib1g-dev rbenv,rubyインストールロール ansible実行ユーザ(ubuntu)のホームディレクトリ以下にrbenvとrubyを入れるロール。 .profileに追加した内容を反映して次に進まないとエラーになる...->要改良 --- - name: retrieve the latest rbenv to ~/.rbenv git: repo=https://github.com/sstephenson/rbenv.git dest=/home/{{user}}/.rbenv accept_hostkey=yes force=yes - name: retrieve the latest ruby-build plugin to ~/.rbenv/plugins/ruby-build git: repo=git://github.com/sstephenson/ruby-build.git dest=/home/{{user}}/.rbenv/plugins/ruby-build accept_hostkey=yes force=yes - name: add path to ~/.rbenv/bin lineinfile: dest=/home/{{user}}/.profile line=\'PATH=\"$HOME/.rbenv/bin:$PATH\"\' state=present create=yes - name: add path to ~/.rbenv/plugins/ruby-build/bin lineinfile: dest=/home/{{user}}/.profile line=\'PATH=\"$HOME/.rbenv/plugins/ruby-build/bin:$PATH\"\' state=present create=yes - name: add initial evaluation of rbenv init lineinfile: dest=/home/{{user}}/.profile line=\'eval \"$(rbenv init -)\"\' state=present create=yes - name: add gem lineinfile: dest=/home/{{user}}/.gemrc line=\"gem{{COLON}} --no-ri --no-rdoc\" state=present create=yes - name: rbenv install 2.4.1 shell: bash -lc \"rbenv install 2.4.1\" - name: rbenv global 2.4.1 shell: bash -lc \"rbenv global 2.4.1\" - name: gem install bundler shell: bash -lc \"gem install bundler\"