Skip to content

Commit

Permalink
[Pending] New syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Senen committed Oct 10, 2023
1 parent fd41953 commit 06bd6bd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 48 deletions.
4 changes: 4 additions & 0 deletions group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ smtp_authentication: "plain"

# Node.js
fnm_dir: "{{ home_dir }}/.fnm"
fnm_command: "export PATH=\"{{ fnm_dir }}:$PATH\" && eval \"$(fnm env)\""

# RVM
rvm_command: "source {{ home_dir }}/.rvm/scripts/rvm"

# Errbit
errbit: False
Expand Down
6 changes: 1 addition & 5 deletions roles/errbit/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,7 @@
replace: ' errbit_host: "https://{{ errbit_domain }}"'

- name: Restart CONSUL DEMOCRACY
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bin/rails restart RAILS_ENV={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bin/rails restart RAILS_ENV={{ env }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash
Expand Down
10 changes: 2 additions & 8 deletions roles/nodejs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@
register: node_version

- name: Install nodejs via fnm
shell: |
export PATH="{{ fnm_dir }}:$PATH"
eval "$(fnm env)"
fnm install {{ node_version.stdout }}
shell: "{{ rvm_command }} && {{ fnm_command }} && fnm install {{ node_version.stdout }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

- name: Install Node packages
shell: |
export PATH="{{ fnm_dir }}:$PATH"
eval "$(fnm env)"
fnm exec npm install --production
shell: "{{ rvm_command }} && {{ fnm_command }} && npm install --production"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash
6 changes: 1 addition & 5 deletions roles/puma/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
when: puma_process.stat.exists == True

- name: Start puma
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bundle exec puma -C {{ release_dir }}/config/puma/{{ env }}.rb -e {{ env }} -d
shell: "{{ rvm_command }} && {{ fnm_command }} && bundle exec puma -C {{ release_dir }}/config/puma/{{ env }}.rb -e {{ env }} -d"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash
Expand Down
6 changes: 1 addition & 5 deletions roles/queue/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
- name: Start DelayedJobs queue
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
RAILS_ENV={{ env }} bin/delayed_job -m -n 2 restart
shell: "{{ rvm_command }} && {{ fnm_command }} && RAILS_ENV={{ env }} bin/delayed_job -m -n 2 restart"
args:
executable: /bin/bash
chdir: "{{ release_dir }}"
30 changes: 5 additions & 25 deletions roles/rails/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@
replace: '{{ env }}:\n # secret_key_base: ""\n server_name: "{{ server_hostname }}"'

- name: Generate secret key
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bin/rake secret RAILS_ENV={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bin/rake secret RAILS_ENV={{ env }}"

register: secret_key_base
args:
Expand All @@ -85,41 +81,25 @@
when: domain is not defined

- name: Create Database
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bin/rake db:migrate RAILS_ENV={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bin/rake db:migrate RAILS_ENV={{ env }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

- name: Load configuration seeds
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bin/rake db:seed RAILS_ENV={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bin/rake db:seed RAILS_ENV={{ env }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

- name: Precompile assets
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bin/rake assets:precompile RAILS_ENV={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bin/rake assets:precompile RAILS_ENV={{ env }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

- name: Update crontab with whenever
shell: |
export PATH="{{ fnm_dir }}:$PATH"
source {{ home_dir }}/.rvm/scripts/rvm
eval "$(fnm env)"
bundle exec whenever --update-crontab {{ app_name }} --set environment={{ env }}
shell: "{{ rvm_command }} && {{ fnm_command }} && bundle exec whenever --update-crontab {{ app_name }} --set environment={{ env }}"
args:
chdir: "{{ release_dir }}"
executable: /bin/bash

0 comments on commit 06bd6bd

Please sign in to comment.