replaced ~ with more reliable data

This commit is contained in:
rene
2022-03-24 17:29:12 +01:00
parent 7267041ea7
commit 267995057b

View File

@@ -3,14 +3,14 @@
- name: mastodon | Clone rbenv
git:
repo: "https://github.com/rbenv/rbenv.git"
dest: "~/.rbenv"
dest: "{{ getent_passwd[user][4] }}/.rbenv"
clone: true
version: "{{ rbenv_version }}"
- name: mastodon | Clone ruby-build
git:
repo: "https://github.com/rbenv/ruby-build.git"
dest: "~/.rbenv/plugins/ruby-build"
dest: "{{ getent_passwd[user][4] }}/.rbenv/plugins/ruby-build"
clone: true
version: "{{ ruby_build_version }}"
register: ruby_build
@@ -18,36 +18,36 @@
- name: mastodon | Configure rbenv
command: ./configure
args:
chdir: "~/.rbenv/src"
chdir: "{{ getent_passwd[user][4] }}/.rbenv/src"
register: rbenv_configure
- name: mastodon | Build rbenv
command: make
args:
chdir: "~/.rbenv/src"
chdir: "{{ getent_passwd[user][4] }}/.rbenv/src"
when: rbenv_configure is succeeded
- name: mastodon | Update profile settings
blockinfile:
dest: "~/.profile"
dest: "{{ getent_passwd[user][4] }}/.profile"
content: |
export PATH="~/.rbenv/bin:${PATH}"
export PATH="{{ getent_passwd[user][4] }}/.rbenv/bin:${PATH}"
eval "$(rbenv init -)"
- name: mastodon | Check if the Ruby version is already installed
shell: "~/.rbenv/bin/rbenv versions | grep -q {{ ruby_version }}"
shell: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv versions | grep -q {{ ruby_version }}"
register: ruby_installed
ignore_errors: yes
check_mode: no
- name: mastodon | Install Ruby {{ ruby_version }}
shell: "~/.rbenv/bin/rbenv install {{ ruby_version }}"
shell: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv install {{ ruby_version }}"
args:
executable: /bin/bash
when: ruby_installed is failed
- name: mastodon | Set the default Ruby version to {{ ruby_version }}
shell: "~/.rbenv/bin/rbenv global {{ ruby_version }}"
shell: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv global {{ ruby_version }}"
args:
executable: /bin/bash
register: default_ruby_version