diff --git a/roles/mastodon-app/tasks/main.yml b/roles/mastodon-app/tasks/main.yml index e123a72..8f47873 100644 --- a/roles/mastodon-app/tasks/main.yml +++ b/roles/mastodon-app/tasks/main.yml @@ -11,15 +11,19 @@ become: true become_user: mastodon - name: Install bundler - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/gem install bundler + shell: cd /home/mastodon/live && gem install bundler args: executable: /bin/bash + environment: + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' become: true become_user: mastodon - name: Use bundler to install the rest of the Ruby dependencies - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle install --deployment --without development test + shell: cd /home/mastodon/live && bundle install --deployment --without development test args: executable: /bin/bash + environment: + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' become: true become_user: mastodon - name: Use yarn to install node.js dependencies diff --git a/roles/mastodon-config/tasks/main.yml b/roles/mastodon-config/tasks/main.yml index adc0183..dfe7951 100644 --- a/roles/mastodon-config/tasks/main.yml +++ b/roles/mastodon-config/tasks/main.yml @@ -4,28 +4,31 @@ # cron job - name: Generate PAPERCLIP_SECRET and register it - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rake secret + shell: cd /home/mastodon/live && bundle exec rake secret register: PAPERCLIP_SECRET environment: RAILS_ENV: production + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true become_user: mastodon - name: Generate SECRET_KEY_BASE and register it - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rake secret + shell: cd /home/mastodon/live && bundle exec rake secret register: SECRET_KEY_BASE environment: RAILS_ENV: production + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true become_user: mastodon - name: Generate OTP_SECRET and register it - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rake secret + shell: cd /home/mastodon/live && bundle exec rake secret register: OTP_SECRET environment: RAILS_ENV: production + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true @@ -38,10 +41,11 @@ become: true become_user: mastodon - name: Generate VAPID keys and register it - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rake mastodon:webpush:generate_vapid_key + shell: cd /home/mastodon/live && bundle exec rake mastodon:webpush:generate_vapid_key register: VAPID_KEYS environment: RAILS_ENV: production + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true @@ -53,18 +57,20 @@ become: true become_user: mastodon - name: Precompile Mastodon static assets - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails assets:precompile + shell: cd /home/mastodon/live && bundle exec rails assets:precompile environment: RAILS_ENV: production + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true become_user: mastodon - name: Run Mastodon database setup - shell: cd /home/mastodon/live && /home/mastodon/.rbenv/shims/bundle exec rails db:setup + shell: cd /home/mastodon/live && bundle exec rails db:setup environment: RAILS_ENV: production SAFETY_ASSURED: 1 + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' args: executable: /bin/bash become: true diff --git a/roles/ruby/tasks/main.yml b/roles/ruby/tasks/main.yml index 4829e3e..9d2e5cb 100644 --- a/roles/ruby/tasks/main.yml +++ b/roles/ruby/tasks/main.yml @@ -29,8 +29,10 @@ become: true become_user: mastodon - name: Install Ruby and set it as the user's default - shell: /home/mastodon/.rbenv/bin/rbenv install 2.4.2 || /home/mastodon/.rbenv/bin/rbenv global 2.4.2 + shell: rbenv install 2.4.2 || rbenv global 2.4.2 args: executable: /bin/bash + environment: + PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}' become: true become_user: mastodon