From 3d2f89b3bdda212c57975cc261ea8c9040aee159 Mon Sep 17 00:00:00 2001 From: binary Date: Mon, 18 Jan 2021 08:51:43 +0100 Subject: Refactor srht role with vars --- roles/srht/tasks/main.yml | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'roles/srht/tasks/main.yml') diff --git a/roles/srht/tasks/main.yml b/roles/srht/tasks/main.yml index 076557f..3815ebc 100644 --- a/roles/srht/tasks/main.yml +++ b/roles/srht/tasks/main.yml @@ -16,7 +16,7 @@ apk update - name: ensure sourcehut is installed - package: name="{{ item }}" state=present + package: name="{{ item }}.sr.ht" state=present loop: "{{ srht_services }}" - name: generate srht service key @@ -38,14 +38,13 @@ owner: "{{ user_root }}" group: "{{ group_root }}" mode: 0644 - loop: - - "meta" - - "hub" + loop: "{{ srht_services }}" + - name: generate srht example configuration template: src: config.ini.j2 - dest: /etc/sr.ht/config.example.ini + dest: /etc/sr.ht/config.ini owner: "{{ user_root }}" group: "{{ group_root }}" mode: 0644 @@ -61,32 +60,38 @@ register: result failed_when: result.rc != 0 and "already exists" not in result.stderr ignore_errors: true - loop: - - "meta" - - "git" - - "hub" + loop: "{{ srht_services }}" become: true become_user: postgres - name: init database for srht services shell: "{{ item }}srht-initdb" - loop: - - "meta" - - "git" - - "hub" + loop: "{{ srht_services }}" - name: enable and restart srht services service: - name: "{{ item }}" + name: "{{ item }}.sr.ht" state: restarted enabled: true loop: "{{ srht_services }}" - name: enable and restart srht api services service: - name: "{{ item }}" + name: "{{ item }}.sr.ht-api" state: restarted enabled: true loop: - - "meta.sr.ht-api" - - "git.sr.ht-api" + - "meta" + - "git" + +- name: enable and restart srht webhooks services + service: + name: "{{ item }}.sr.ht-webhooks" + state: restarted + enabled: true + loop: + - "meta" + - "git" + +- name: restart nginx + service: name=nginx state=restarted -- cgit v1.2.3