From f9bd653391107b0ed5a10d9da3438c88080298c2 Mon Sep 17 00:00:00 2001 From: rene Date: Thu, 24 Mar 2022 17:57:11 +0100 Subject: [PATCH] replaced ~ with more reliable data --- .../mastodon/tasks/system_setup/mastodon.yml | 12 +++++------ roles/mastodon/tasks/system_setup/ruby.yml | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/mastodon/tasks/system_setup/mastodon.yml b/roles/mastodon/tasks/system_setup/mastodon.yml index eb8835d..e0ff4d6 100644 --- a/roles/mastodon/tasks/system_setup/mastodon.yml +++ b/roles/mastodon/tasks/system_setup/mastodon.yml @@ -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 diff --git a/roles/mastodon/tasks/system_setup/ruby.yml b/roles/mastodon/tasks/system_setup/ruby.yml index da472c6..c4b21ec 100644 --- a/roles/mastodon/tasks/system_setup/ruby.yml +++ b/roles/mastodon/tasks/system_setup/ruby.yml @@ -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 }}" \ No newline at end of file + become_mastodon_user: "{{ mastodon_user }}" \ No newline at end of file