2021-03-21 02:22:36 +01:00
|
|
|
---
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Generate gitea SECRET_KEY if not provided
|
2021-03-21 02:22:36 +01:00
|
|
|
become: true
|
2022-08-22 13:33:20 +02:00
|
|
|
ansible.builtin.shell: 'umask 077; {{ gitea_executable_path }} generate secret SECRET_KEY > {{ gitea_configuraion_path }}/gitea_secret_key'
|
2021-03-21 02:22:36 +01:00
|
|
|
args:
|
2022-08-22 13:33:20 +02:00
|
|
|
creates: '{{ gitea_configuraion_path }}/gitea_secret_key'
|
2021-09-24 11:50:31 +02:00
|
|
|
when: gitea_secret_key | string | length == 0
|
2021-03-21 02:22:36 +01:00
|
|
|
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Read gitea SECRET_KEY from file
|
2021-03-21 02:22:36 +01:00
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.slurp:
|
2022-08-22 13:33:20 +02:00
|
|
|
src: '{{ gitea_configuraion_path }}/gitea_secret_key'
|
2021-03-21 02:29:29 +01:00
|
|
|
register: remote_secret_key
|
2021-09-24 11:50:31 +02:00
|
|
|
when: gitea_secret_key | string | length == 0
|
2021-03-21 02:22:36 +01:00
|
|
|
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Set fact gitea_secret_key
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-03-21 02:22:36 +01:00
|
|
|
gitea_secret_key: "{{ remote_secret_key['content'] | b64decode }}"
|
2022-09-29 23:09:19 +02:00
|
|
|
when: gitea_secret_key | string | length == 0
|
2021-03-21 02:22:36 +01:00
|
|
|
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Generate gitea INTERNAL_TOKEN if not provided
|
2021-03-21 02:22:36 +01:00
|
|
|
become: true
|
2022-08-22 13:33:20 +02:00
|
|
|
ansible.builtin.shell: 'umask 077; {{ gitea_executable_path }} generate secret INTERNAL_TOKEN > {{ gitea_configuraion_path }}/gitea_internal_token'
|
2021-03-21 02:22:36 +01:00
|
|
|
args:
|
2022-08-22 13:33:20 +02:00
|
|
|
creates: '{{ gitea_configuraion_path }}/gitea_internal_token'
|
2021-09-24 11:50:31 +02:00
|
|
|
when: gitea_internal_token | string | length == 0
|
2021-03-21 02:22:36 +01:00
|
|
|
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Read gitea INTERNAL_TOKEN from file
|
2021-03-21 02:22:36 +01:00
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.slurp:
|
2022-08-22 13:33:20 +02:00
|
|
|
src: '{{ gitea_configuraion_path }}/gitea_internal_token'
|
2021-03-21 02:22:36 +01:00
|
|
|
register: remote_internal_token
|
2021-09-24 11:50:31 +02:00
|
|
|
when: gitea_internal_token | string | length == 0
|
2021-03-21 02:22:36 +01:00
|
|
|
|
2022-09-29 23:09:19 +02:00
|
|
|
- name: Set fact gitea_internal_token
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-03-21 02:22:36 +01:00
|
|
|
gitea_internal_token: "{{ remote_internal_token['content'] | b64decode }}"
|
2021-09-24 11:50:31 +02:00
|
|
|
when: gitea_internal_token | string | length == 0
|