fix existing secrets

This commit is contained in:
Antonio J. Delgado 2022-11-19 20:23:42 +02:00
parent e55bd72716
commit 0da08aeafd

View file

@ -39,10 +39,15 @@
register: secret_key_cmd register: secret_key_cmd
when: mastodon_secret_key_base == '' when: mastodon_secret_key_base == ''
- name: Set mastodon_secret_key_base
set_fact:
mastodon_secret_key_base: "{{ secret_key_cmd.stdout }}"
when: mastodon_secret_key_base == ''
- name: Add secret key to Mastodon config - name: Add secret key to Mastodon config
lineinfile: lineinfile:
path: "{{ mastodon_composer_folder }}/.env.production" path: "{{ mastodon_composer_folder }}/.env.production"
line: "SECRET_KEY_BASE={{ secret_key_cmd.stdout }}" line: "SECRET_KEY_BASE={{ mastodon_secret_key_base }}"
regexp: "^SECRET_KEY_BASE=" regexp: "^SECRET_KEY_BASE="
backup: yes backup: yes
@ -53,10 +58,15 @@
register: otp_key_cmd register: otp_key_cmd
when: mastodon_otp_secret == '' when: mastodon_otp_secret == ''
- name: Set mastodon_otp_secret
set_fact:
mastodon_otp_secret: "{{ otp_key_cmd.stdout }}"
when: mastodon_otp_secret == ''
- name: Add OTP key to Mastodon config - name: Add OTP key to Mastodon config
lineinfile: lineinfile:
path: "{{ mastodon_composer_folder }}/.env.production" path: "{{ mastodon_composer_folder }}/.env.production"
line: "OTP_SECRET={{ otp_key_cmd.stdout }}" line: "OTP_SECRET={{ mastodon_otp_secret }}"
regexp: "^OTP_SECRET=" regexp: "^OTP_SECRET="
backup: yes backup: yes
@ -67,10 +77,15 @@
register: paperclip_key_cmd register: paperclip_key_cmd
when: mastodon_paperclip_secret == '' when: mastodon_paperclip_secret == ''
- name: Set mastodon_paperclip_secret
set_fact:
mastodon_paperclip_secret: "{{ otppaperclip_key_cmd_key_cmd.stdout }}"
when: mastodon_paperclip_secret == ''
- name: Add Paperclip key to Mastodon config - name: Add Paperclip key to Mastodon config
lineinfile: lineinfile:
path: "{{ mastodon_composer_folder }}/.env.production" path: "{{ mastodon_composer_folder }}/.env.production"
line: "PAPERCLIP_SECRET={{ paperclip_key_cmd.stdout }}" line: "PAPERCLIP_SECRET={{ mastodon_paperclip_secret }}"
regexp: "^PAPERCLIP_SECRET=" regexp: "^PAPERCLIP_SECRET="
backup: yes backup: yes
@ -81,17 +96,27 @@
register: vapid_key_cmd register: vapid_key_cmd
when: vapid_public_key == '' when: vapid_public_key == ''
- name: Set vapid_public_key
set_fact:
vapid_public_key: "{{ vapid_key_cmd.stdout_lines[1] }}"
when: vapid_public_key == ''
- name: Set vapid_private_key
set_fact:
vapid_private_key: "{{ vapid_key_cmd.stdout_lines[0] }}"
when: vapid_private_key == ''
- name: Add Paperclip private key to Mastodon config - name: Add Paperclip private key to Mastodon config
lineinfile: lineinfile:
path: "{{ mastodon_composer_folder }}/.env.production" path: "{{ mastodon_composer_folder }}/.env.production"
line: "{{ vapid_key_cmd.stdout_lines[0] }}" line: "{{ vapid_private_key }}"
regexp: "^VAPID_PRIVATE_KEY=" regexp: "^VAPID_PRIVATE_KEY="
backup: yes backup: yes
- name: Add Paperclip public key to Mastodon config - name: Add Paperclip public key to Mastodon config
lineinfile: lineinfile:
path: "{{ mastodon_composer_folder }}/.env.production" path: "{{ mastodon_composer_folder }}/.env.production"
line: "{{ vapid_key_cmd.stdout_lines[1] }}" line: "{{ vapid_public_key }}"
regexp: "^VAPID_PUBLIC_KEY=" regexp: "^VAPID_PUBLIC_KEY="
backup: yes backup: yes