aboutsummaryrefslogtreecommitdiff
path: root/roles/gitea/tasks/secrets.yml
blob: a5da3bba6dbfe9d97bb68a760ae1aa010f64309e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
# Secret Key

- name: Generate SECRET_KEY
  command:
    cmd: gitea generate secret SECRET_KEY
    creates: /etc/gitea/secret_key
  become_user: git
  become: yes
  register: gen_sec_key

- name: Save secret Key
  copy:
    content: '{{ gen_sec_key.stdout }}'
    dest: /etc/gitea/secret_key
    owner: root
    group: git
    mode: '640'
  become: yes
  when: gen_sec_key.changed

# Internale Token

- name: Generate INTERNAL_TOKEN
  command:
    cmd: gitea generate secret INTERNAL_TOKEN
    creates: /etc/gitea/internal_token
  become_user: git
  become: yes
  register: gen_int_tok

- name: Save INTERNAL_TOKEN
  copy:
    content: '{{ gen_int_tok.stdout }}'
    dest: /etc/gitea/internal_token
    owner: root
    group: git
    mode: '640'
  become: yes
  when: gen_int_tok.changed

# JWT

- name: Generate JWT_SECRET
  command:
    cmd: gitea generate secret INTERNAL_TOKEN
    creates: /etc/gitea/jwt_secret
  become_user: git
  become: yes
  register: gen_jwt_sec

- name: Save JWT_SECRET
  copy:
    content: '{{ gen_jwt_sec.stdout }}'
    dest: /etc/gitea/jwt_secret
    owner: root
    group: git
    mode: '640'
  become: yes
  when: gen_jwt_sec.changed