perform task only if some file does not exist
This commit is contained in:
@@ -10,6 +10,9 @@
|
|||||||
args:
|
args:
|
||||||
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
||||||
|
|
||||||
|
- stat: path={{ mastodon_home }}/{{ mastodon_path }}/.env.production
|
||||||
|
register: production_config
|
||||||
|
|
||||||
- name: Bundle install
|
- name: Bundle install
|
||||||
shell: |
|
shell: |
|
||||||
{{ mastodon_home }}/.rbenv/shims/bundle config set --local deployment 'true' && \
|
{{ mastodon_home }}/.rbenv/shims/bundle config set --local deployment 'true' && \
|
||||||
@@ -18,11 +21,13 @@
|
|||||||
{{ mastodon_home }}/.rbenv/shims/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
{{ mastodon_home }}/.rbenv/shims/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||||
args:
|
args:
|
||||||
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
||||||
|
when: not production_config.stat.exists
|
||||||
|
|
||||||
- name: Yarn install
|
- name: Yarn install
|
||||||
command: yarn install --pure-lockfile
|
command: yarn install --pure-lockfile
|
||||||
args:
|
args:
|
||||||
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
|
||||||
|
when: not production_config.stat.exists
|
||||||
|
|
||||||
- name: Media cleanup cronjob
|
- name: Media cleanup cronjob
|
||||||
cron:
|
cron:
|
||||||
@@ -30,9 +35,7 @@
|
|||||||
minute: "15"
|
minute: "15"
|
||||||
hour: "1"
|
hour: "1"
|
||||||
job: '/bin/bash -c ''export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; cd {{ mastodon_home }}/{{ mastodon_path }} && RAILS_ENV=production ./bin/tootctl media remove'''
|
job: '/bin/bash -c ''export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; cd {{ mastodon_home }}/{{ mastodon_path }} && RAILS_ENV=production ./bin/tootctl media remove'''
|
||||||
|
when: not production_config.stat.exists
|
||||||
- stat: path={{ mastodon_home }}/{{ mastodon_path }}/.env.production
|
|
||||||
register: production_config
|
|
||||||
|
|
||||||
- name: Migrate database
|
- name: Migrate database
|
||||||
shell: "RAILS_ENV=production {{ mastodon_home }}/.rbenv/shims/bundle exec rails db:migrate"
|
shell: "RAILS_ENV=production {{ mastodon_home }}/.rbenv/shims/bundle exec rails db:migrate"
|
||||||
|
|||||||
Reference in New Issue
Block a user