2024-10-22 10:55:56 +02:00
|
|
|
- name: Dossier pour le service docker
|
|
|
|
ansible.builtin.file:
|
2022-05-29 12:20:38 +02:00
|
|
|
path: /opt/{{ docker_mastodon_service_id }}/
|
|
|
|
state: directory
|
|
|
|
|
2024-10-22 10:55:56 +02:00
|
|
|
- name: Prepare docker-compose.yml
|
|
|
|
ansible.builtin.template:
|
2022-05-29 12:20:38 +02:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /opt/{{ docker_mastodon_service_id }}/
|
|
|
|
with_items:
|
|
|
|
- docker-compose.yml
|
|
|
|
- .env.production
|
|
|
|
|
2024-10-22 10:55:56 +02:00
|
|
|
- name: Generation des secrets
|
2022-05-29 12:20:38 +02:00
|
|
|
when: docker_mastodon_gen_secrets is true
|
|
|
|
block:
|
2024-10-22 10:55:56 +02:00
|
|
|
|
|
|
|
- name: Script pour la génération des secrets
|
|
|
|
ansible.builtin.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
|
|
|
|
docker compose run --rm web bin/rails db:encryption:init
|
|
|
|
docker compose down
|
|
|
|
args:
|
|
|
|
chdir: /opt/{{ docker_mastodon_service_id }}/
|
|
|
|
register: secrets
|
|
|
|
|
|
|
|
- name: Affiche les secrets
|
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "{{ secrets.stdout_lines }}"
|
|
|
|
|
|
|
|
- name: On s'arrête ici si docker_mastodon_gen_secrets est défini
|
|
|
|
ansible.builtin.assert:
|
2022-05-29 12:20:38 +02:00
|
|
|
that:
|
|
|
|
- docker_mastodon_gen_secrets is false
|
|
|
|
|
|
|
|
### initialize-data
|
2024-10-22 10:55:56 +02:00
|
|
|
- name: Migration BDD et précompilation
|
|
|
|
ansible.builtin.shell: |
|
2023-12-30 19:27:10 +01:00
|
|
|
docker compose down
|
|
|
|
docker compose run --rm web rails db:migrate
|
|
|
|
docker compose run --rm web rails assets:precompile
|
|
|
|
docker compose down
|
2022-05-29 12:20:38 +02:00
|
|
|
args:
|
|
|
|
chdir: /opt/{{ docker_mastodon_service_id }}/
|
|
|
|
when: docker_mastodon_initialize_data is true
|
|
|
|
|
2024-10-22 10:55:56 +02:00
|
|
|
- name: Démarrage
|
|
|
|
ansible.builtin.shell: |
|
2023-12-30 19:27:10 +01:00
|
|
|
docker compose up -d
|
2022-05-29 12:20:38 +02:00
|
|
|
args:
|
|
|
|
chdir: /opt/{{ docker_mastodon_service_id }}/
|