replaced ~ with more reliable data

This commit is contained in:
rene
2022-03-24 17:57:11 +01:00
parent 267995057b
commit f9bd653391
2 changed files with 16 additions and 16 deletions

View File

@@ -12,10 +12,10 @@
- name: Bundle install
shell: |
~/.rbenv/shims/bundle config set --local deployment 'true' && \
~/.rbenv/shims/bundle config set --local without 'test' && \
~/.rbenv/shims/bundle config set --local with 'development' && \
~/.rbenv/shims/bundle install -j$(getconf _NPROCESSORS_ONLN)
{{ mastodon_home }}/.rbenv/shims/bundle config set --local deployment 'true' && \
{{ mastodon_home }}/.rbenv/shims/bundle config set --local without 'test' && \
{{ mastodon_home }}/.rbenv/shims/bundle config set --local with 'development' && \
{{ mastodon_home }}/.rbenv/shims/bundle install -j$(getconf _NPROCESSORS_ONLN)
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
@@ -35,13 +35,13 @@
register: production_config
- name: Migrate database
shell: "RAILS_ENV=production ~/.rbenv/shims/bundle exec rails db:migrate"
shell: "RAILS_ENV=production {{ mastodon_home }}/.rbenv/shims/bundle exec rails db:migrate"
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
when: production_config.stat.exists
- name: Precompile assets
shell: "RAILS_ENV=production ~/.rbenv/shims/bundle exec rails assets:precompile"
shell: "RAILS_ENV=production {{ mastodon_home }}/.rbenv/shims/bundle exec rails assets:precompile"
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
when: production_config.stat.exists

View File

@@ -3,14 +3,14 @@
- name: mastodon | Clone rbenv
git:
repo: "https://github.com/rbenv/rbenv.git"
dest: "{{ getent_passwd[user][4] }}/.rbenv"
dest: "{{ getent_passwd[mastodon_user][4] }}/.rbenv"
clone: true
version: "{{ rbenv_version }}"
- name: mastodon | Clone ruby-build
git:
repo: "https://github.com/rbenv/ruby-build.git"
dest: "{{ getent_passwd[user][4] }}/.rbenv/plugins/ruby-build"
dest: "{{ getent_passwd[mastodon_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: "{{ getent_passwd[user][4] }}/.rbenv/src"
chdir: "{{ getent_passwd[mastodon_user][4] }}/.rbenv/src"
register: rbenv_configure
- name: mastodon | Build rbenv
command: make
args:
chdir: "{{ getent_passwd[user][4] }}/.rbenv/src"
chdir: "{{ getent_passwd[mastodon_user][4] }}/.rbenv/src"
when: rbenv_configure is succeeded
- name: mastodon | Update profile settings
blockinfile:
dest: "{{ getent_passwd[user][4] }}/.profile"
dest: "{{ getent_passwd[mastodon_user][4] }}/.profile"
content: |
export PATH="{{ getent_passwd[user][4] }}/.rbenv/bin:${PATH}"
export PATH="{{ getent_passwd[mastodon_user][4] }}/.rbenv/bin:${PATH}"
eval "$(rbenv init -)"
- name: mastodon | Check if the Ruby version is already installed
shell: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv versions | grep -q {{ ruby_version }}"
shell: "{{ getent_passwd[mastodon_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: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv install {{ ruby_version }}"
shell: "{{ getent_passwd[mastodon_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: "{{ getent_passwd[user][4] }}/.rbenv/bin/rbenv global {{ ruby_version }}"
shell: "{{ getent_passwd[mastodon_user][4] }}/.rbenv/bin/rbenv global {{ ruby_version }}"
args:
executable: /bin/bash
register: default_ruby_version
@@ -59,4 +59,4 @@
when: default_ruby_version is succeeded
become: true
become_user: "{{ mastodon_user }}"
become_mastodon_user: "{{ mastodon_user }}"