diff --git a/handlers/backup.yaml b/handlers/backup.yaml index 746b357..e0ea60e 100644 --- a/handlers/backup.yaml +++ b/handlers/backup.yaml @@ -5,7 +5,7 @@ listen: - Backup Gitea -- name: Stop Gitea for Backup +- name: Stop Gitea for backup community.docker.docker_compose: project_src: /opt/gitea state: present @@ -17,7 +17,7 @@ - Ensure Gitea is running when: docker_compose_stat.stat.exists is defined and docker_compose_stat.stat.exists -- name: Backup Gitea Directory +- name: Backup Gitea directory community.general.archive: path: /opt/gitea/ dest: "/var/backups/gitea-{{ gitea.hostname }}.{{ gitea.domain }}@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}.tar.gz" diff --git a/handlers/main.yaml b/handlers/main.yaml index 3b5fef5..131082e 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -1,4 +1,4 @@ -- name: Import Backup Handler +- name: Import backup handler ansible.builtin.import_tasks: file: backup.yaml @@ -13,7 +13,7 @@ project_src: /opt/gitea register: docker_compose -- name: Get Gitea HTTP Response +- name: Get Gitea HTTP response ansible.builtin.uri: url: "https://{{ gitea.hostname }}.{{ gitea.domain }}" register: gitea_http_response @@ -27,6 +27,6 @@ retries: 30 delay: 2 -- name: Output Docker Compose State +- name: Output docker compose state ansible.builtin.debug: var: docker_compose diff --git a/tasks/main.yaml b/tasks/main.yaml index fcfc825..0903783 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -5,19 +5,19 @@ # - docker.io # - python3-docker -- name: Create git USER +- name: Ensure git user exists ansible.builtin.user: name: git register: git_user -- name: Create Gitea +- name: Ensure Gitea directory exists ansible.builtin.file: path: "/opt/gitea" state: directory owner: root mode: "755" -- name: Create Data Directory +- name: Ensure data directory exists ansible.builtin.file: path: "/opt/gitea/data" state: directory @@ -25,7 +25,7 @@ group: "{{ git_user.group }}" mode: "700" -- name: Create Config Directory +- name: Ensure config directory exists ansible.builtin.file: path: "/opt/gitea/config" state: directory @@ -33,7 +33,7 @@ group: "{{ git_user.group }}" mode: "700" -- name: Start Docker Daemon +- name: Ensure docker daemon is started ansible.builtin.systemd: name: docker enabled: true @@ -61,10 +61,10 @@ notify: - Backup Gitea -- name: Execute Handlers before changing configfiles +- name: Execute handlers before changing configfiles ansible.builtin.meta: flush_handlers -- name: Upload Environment File +- name: Upload environment.env ansible.builtin.template: src: environment.env.j2 dest: "/opt/gitea/environment.env" @@ -81,6 +81,6 @@ owner: root mode: "600" notify: - - Output Docker Compose State + - Output docker compose state - Ensure Gitea is restarted - Wait until Gitea is up