Found a way to adjust the gitea configuration after the installation.

This commit is contained in:
Andrea Dell'Amico 2019-03-29 20:03:05 +01:00
parent 49defcf825
commit edd35277db
2 changed files with 23 additions and 3 deletions

View File

@ -69,3 +69,11 @@ gitea_prometheus_metrics: False
#gitea_prometheus_bearer_token: put it into a vault file
gitea_prometheus_bearer_token: ''
gitea_log_level: Info
# gitea_app_configurations:
# - { section: 'mailer', option: 'ENABLED', value: 'true', state: 'present' }
# - { section: 'mailer', option: 'FROM', value: '{{ gitea_mail_from }}', state: 'present' }
# - { section: 'mailer', option: 'MAILER_TYPE', value: '{{ gitea_mailer_type }}', state: 'present' }
# - { section: 'mailer', option: 'SENDMAIL_PATH', value: '{{ gitea_sendmail_path }}', state: 'present' }
# - { section: 'metrics', option: 'ENABLED', value: 'true', state: 'present' }
# - { section: 'metrics', option: 'TOKEN', value: '{{ gitea_prometheus_bearer_token }}', state: 'present' }

View File

@ -16,9 +16,21 @@
- name: Install the required packages
package: state=present use=auto name={{ gitea_required_packages }}
- name: Configure gitea
template: src=app.ini.j2 dest={{ gitea_conf_dir }}/app.ini owner=root group={{ gitea_group }} mode=0640
notify: reload gitea
- name: Check if the gitea configuration file exists
stat: path={{ gitea_conf_dir }}/app.ini
register: gitea_app_ini
- name: Change the gitea configuration. After the installation
ini_file: path={{ gitea_conf_dir }}/app.ini section={{ item.section }} option={{ item.option }} value={{ item.value }} state={{ item.state }} owner={{ gitea_user }} group={{ gitea_group }} mode=0640 create=no
with_items: '{{ gitea_app_configurations }}'
when:
- gitea_app_ini.stat.exists
- gitea_app_configurations is defined
notify: restart gitea
- name: Install the gitea configuration file. At install time only
template: src=app.ini.j2 dest={{ gitea_conf_dir }}/app.ini owner={{ gitea_user }} group={{ gitea_group }} mode=0640 force=no
notify: restart gitea
- name: Install the gitea systemd unit
template: src=gitea.service.systemd dest=/etc/systemd/system/gitea.service