- name: docker directory file: path: /opt/{{ docker_mastodon_service_id }}/ state: directory - name: prepare docker-compose.yml template: src: "{{ item }}" dest: /opt/{{ docker_mastodon_service_id }}/ with_items: - docker-compose.yml - .env.production - name: generate secrets when: docker_mastodon_gen_secrets is true block: - name: docker-compose-gen-secrets shell: | docker-compose down echo "Placer les valeurs suivantes dans les variables du playbook mastodon :" echo SECRET_KEY_BASE=$(docker-compose run --rm web bundle exec rake secret) echo OTP_SECRET=$(docker-compose run --rm web bundle exec rake secret) docker-compose run --rm web bundle exec rake mastodon:webpush:generate_vapid_key args: chdir: /opt/{{ docker_mastodon_service_id }}/ register: secrets - debug: msg: "{{ secrets.stdout_lines }}" - name: Playbook stops here if docker_mastodon_gen_secrets is set assert: that: - docker_mastodon_gen_secrets is false ### initialize-data - name: docker-compose-initialize-data shell: | docker-compose down rm -rf "{{ docker_mastodon_data_dir }}/{{ docker_mastodon_service_id }}" docker-compose run --rm web rails db:migrate docker-compose run --rm web rails assets:precompile docker-compose down args: chdir: /opt/{{ docker_mastodon_service_id }}/ when: docker_mastodon_initialize_data is true - name: docker-compose-up shell: | docker-compose up -d args: chdir: /opt/{{ docker_mastodon_service_id }}/