Skip to content

Commit

Permalink
Simplify commands by using the newly added variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Senen committed Oct 16, 2023
1 parent 5bfddc9 commit 150522c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions roles/errbit/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
executable: /bin/bash

- name: Install libv8-node for the right platform
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && gem install libv8-node --version '{{ libv8_version.stdout }}' --platform x86_64-linux-libc"
shell: "{{ rvm_command }} && gem install libv8-node --version '{{ libv8_version.stdout }}' --platform x86_64-linux-libc"
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash
Expand All @@ -48,13 +48,13 @@
executable: /bin/bash

- name: Install the mini_racer gem
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && gem install mini_racer --version '{{ mini_racer_version.stdout }}'"
shell: "{{ rvm_command }} && gem install mini_racer --version '{{ mini_racer_version.stdout }}'"
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash

- name: Install Errbit dependencies
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && bundle install"
shell: "{{ rvm_command }} && bundle install"
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash
Expand All @@ -81,7 +81,7 @@
- when: not existing_secret_key_base.found
block:
- name: Generate secret key
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && bin/rake secret"
shell: "{{ rvm_command }} && bin/rake secret"
register: secret_key_base
args:
chdir: "{{ errbit_dir }}"
Expand All @@ -93,13 +93,13 @@
line: "SECRET_KEY_BASE={{ secret_key_base.stdout }}"

- name: Setup Errbit
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && RAILS_ENV={{ env }} bin/rake errbit:bootstrap"
shell: "{{ rvm_command }} && RAILS_ENV={{ env }} bin/rake errbit:bootstrap"
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash

- name: Precompile Errbit assets
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && RAILS_ENV={{ env }} bin/rake assets:precompile"
shell: "{{ rvm_command }} && RAILS_ENV={{ env }} bin/rake assets:precompile"
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash
Expand All @@ -121,7 +121,7 @@
enabled: true

- name: Create app if it does not exist
shell: 'source /home/{{ deploy_user }}/.rvm/scripts/rvm && bin/rails runner -e {{ env }} "App.create(name: \"{{ domain }}\")"'
shell: '{{ rvm_command }} && bin/rails runner -e {{ env }} "App.create(name: \"{{ domain }}\")"'
args:
chdir: "{{ errbit_dir }}"
executable: /bin/bash
Expand Down
2 changes: 1 addition & 1 deletion roles/errbit/templates/errbit.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ After=mongodb.service network.target
Type=simple
WorkingDirectory={{ errbit_dir }}
Environment=RAILS_ENV={{ env }}
ExecStart=/bin/bash -lc 'source {{ home_dir }}/.rvm/scripts/rvm && bundle exec puma -C {{ errbit_dir }}/config/puma.default.rb -e {{ env }}'
ExecStart=/bin/bash -lc '{{ rvm_command }} && bundle exec puma -C {{ errbit_dir }}/config/puma.default.rb -e {{ env }}'
Restart=always
User={{ errbit_user }}
Group={{ errbit_group }}
Expand Down
6 changes: 3 additions & 3 deletions roles/rails/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Configure Bundler path
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && bundle config --local path {{ shared_dir }}/bundle"
shell: "{{ rvm_command }} && bundle config --local path {{ shared_dir }}/bundle"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

- name: Configure Bundler environments
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && bundle config --local without development:test"
shell: "{{ rvm_command }} && bundle config --local without development:test"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash
Expand All @@ -26,7 +26,7 @@
when: not usr_bin_mkdir.stat.exists

- name: Install gems (this may take a few minutes)
shell: "source /home/{{ deploy_user }}/.rvm/scripts/rvm && bundle install"
shell: "{{ rvm_command }} && bundle install"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash
Expand Down

0 comments on commit 150522c

Please sign in to comment.