|
90 | 90 | state: present
|
91 | 91 | when: "ansible_facts['service_mgr'] != 'systemd' and gitea_port | int < 1024"
|
92 | 92 |
|
93 |
| -- name: 'create required directories' |
94 |
| - file: |
95 |
| - path: "{{ directory.path }}" |
96 |
| - state: directory |
97 |
| - owner: "{{ directory.owner | default(gitea_user) }}" |
98 |
| - group: "{{ directory.group | default(gitea_group) }}" |
99 |
| - mode: "{{ directory.mode | default('0750') }}" |
100 |
| - loop: |
101 |
| - - path: '/etc/gitea' |
102 |
| - owner: root |
103 |
| - - path: "{{ gitea_data_path }}" |
104 |
| - - path: "{{ gitea_custom_path }}" |
105 |
| - owner: root |
106 |
| - - path: "{{ gitea_log_path }}" |
107 |
| - loop_control: |
108 |
| - loop_var: directory |
109 |
| - label: "{{ directory.path }}" |
110 |
| - |
111 | 93 | - name: 'check if Gitea is already configured'
|
112 | 94 | stat:
|
113 | 95 | path: '/etc/gitea/app.ini'
|
|
128 | 110 | loop_control:
|
129 | 111 | loop_var: secret
|
130 | 112 |
|
| 113 | +- name: 'combine default and custom options' |
| 114 | + set_fact: |
| 115 | + _gitea_options: "{{ gitea_default_options | combine(gitea_extra_options, recursive=True) }}" |
| 116 | + |
| 117 | +- name: 'create required directories' |
| 118 | + file: |
| 119 | + path: "{{ directory.path }}" |
| 120 | + state: directory |
| 121 | + owner: "{{ directory.owner | default(gitea_user) }}" |
| 122 | + group: "{{ directory.group | default(gitea_group) }}" |
| 123 | + mode: "{{ directory.mode | default('0750') }}" |
| 124 | + loop: |
| 125 | + - path: '/etc/gitea' |
| 126 | + owner: root |
| 127 | + - path: "{{ gitea_data_path }}" |
| 128 | + - path: "{{ _gitea_options['git']['HOME_PATH'] }}" |
| 129 | + - path: "{{ gitea_custom_path }}" |
| 130 | + owner: root |
| 131 | + - path: "{{ gitea_log_path }}" |
| 132 | + loop_control: |
| 133 | + loop_var: directory |
| 134 | + label: "{{ directory.path }}" |
| 135 | + |
131 | 136 | - name: 'configure Gitea'
|
132 | 137 | template:
|
133 | 138 | dest: '/etc/gitea/app.ini'
|
|
152 | 157 | command: "su {{ gitea_user }} -c 'gpg --batch --generate-key'"
|
153 | 158 | args:
|
154 | 159 | warn: false # su is needed, otherwise Ansible might require a password to become the gitea user
|
155 |
| - creates: "{{ gitea_data_path }}/.gnupg/private-keys-v1.d/" |
| 160 | + creates: "{{ _gitea_options['git']['HOME_PATH'] }}/.gnupg/private-keys-v1.d/" |
156 | 161 | stdin: |
|
157 | 162 | %no-protection
|
158 | 163 | Key-Type: {{ gitea_signing_key_type }}
|
|
166 | 171 |
|
167 | 172 | - name: 'configure git command line client'
|
168 | 173 | ini_file:
|
169 |
| - path: "{{ gitea_data_path }}/.gitconfig" |
| 174 | + path: "{{ _gitea_options['git']['HOME_PATH'] }}/.gitconfig" |
170 | 175 | section: "{{ item.section }}"
|
171 | 176 | option: "{{ item.option }}"
|
172 | 177 | value: "{{ item.value }}"
|
|
0 commit comments