perform task only if some file does not exist

This commit is contained in:
rene
2022-04-21 16:52:08 +02:00
parent b8fc17e19b
commit 703c7db3b9

View File

@@ -10,6 +10,9 @@
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
- stat: path={{ mastodon_home }}/{{ mastodon_path }}/.env.production
register: production_config
- name: Bundle install
shell: |
{{ mastodon_home }}/.rbenv/shims/bundle config set --local deployment 'true' && \
@@ -18,11 +21,13 @@
{{ mastodon_home }}/.rbenv/shims/bundle install -j$(getconf _NPROCESSORS_ONLN)
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
when: not production_config.stat.exists
- name: Yarn install
command: yarn install --pure-lockfile
args:
chdir: "{{ mastodon_home }}/{{ mastodon_path }}"
when: not production_config.stat.exists
- name: Media cleanup cronjob
cron:
@@ -30,9 +35,7 @@
minute: "15"
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'''
- stat: path={{ mastodon_home }}/{{ mastodon_path }}/.env.production
register: production_config
when: not production_config.stat.exists
- name: Migrate database
shell: "RAILS_ENV=production {{ mastodon_home }}/.rbenv/shims/bundle exec rails db:migrate"