2021-02-10 20:04:13 +01:00
|
|
|
---
|
|
|
|
- name: generate OAuth2 JWT_SECRET if not provided
|
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_oauth_jwt_secret'
|
2021-02-10 20:04:13 +01:00
|
|
|
args:
|
|
|
|
creates: '/etc/gitea/gitea_oauth_jwt_secret'
|
|
|
|
when: gitea_oauth2_jwt_secret | length == 0
|
|
|
|
|
|
|
|
- name: read OAuth2 JWT_SECRET from file
|
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.slurp:
|
2021-02-10 20:04:13 +01:00
|
|
|
src: '/etc/gitea/gitea_oauth_jwt_secret'
|
|
|
|
register: oauth_jwt_secret
|
|
|
|
when: gitea_oauth2_jwt_secret | length == 0
|
|
|
|
|
|
|
|
- name: set fact gitea_oauth2_jwt_secret
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-02-10 20:04:13 +01:00
|
|
|
gitea_oauth2_jwt_secret: "{{ oauth_jwt_secret['content'] | b64decode }}"
|
|
|
|
when: gitea_oauth2_jwt_secret | length == 0
|
|
|
|
|
|
|
|
- name: generate LFS JWT_SECRET if not provided
|
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.shell: 'umask 077; /usr/local/bin/gitea generate secret JWT_SECRET > /etc/gitea/gitea_lfs_jwt_secret'
|
2021-02-10 20:04:13 +01:00
|
|
|
args:
|
|
|
|
creates: '/etc/gitea/gitea_lfs_jwt_secret'
|
|
|
|
when: gitea_lfs_jwt_secret | length == 0
|
|
|
|
|
|
|
|
- name: read LFS JWT_SECRET from file
|
|
|
|
become: true
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.slurp:
|
2021-02-10 20:04:13 +01:00
|
|
|
src: '/etc/gitea/gitea_lfs_jwt_secret'
|
|
|
|
register: lfs_jwt_secret
|
|
|
|
when: gitea_lfs_jwt_secret | length == 0
|
|
|
|
|
|
|
|
- name: set fact gitea_lfs_jwt_secret
|
2021-03-22 21:28:51 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-02-10 20:04:13 +01:00
|
|
|
gitea_lfs_jwt_secret: "{{ lfs_jwt_secret['content'] | b64decode }}"
|
|
|
|
when: gitea_lfs_jwt_secret | length == 0
|