diff --git a/gitea/defaults/main.yml b/gitea/defaults/main.yml index 5744264f..0dfe84b1 100644 --- a/gitea/defaults/main.yml +++ b/gitea/defaults/main.yml @@ -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' } diff --git a/gitea/tasks/main.yml b/gitea/tasks/main.yml index 0b767dcb..443765d1 100644 --- a/gitea/tasks/main.yml +++ b/gitea/tasks/main.yml @@ -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