feat: implement checks for existing services repository and handle initial clone or update
Some checks failed
Nix Format Check / check-format (push) Failing after 38s

This commit is contained in:
Menno van Leeuwen 2025-03-10 21:48:55 +01:00
parent 53aca071e4
commit 0a79d2f3e3
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -12,7 +12,29 @@
ignore_errors: true
become: true
- name: Update/Checkout /mnt/services repository
- name: Check if services git repo already exists
ansible.builtin.stat:
path: "/mnt/services/.git"
register: git_dir_check
become: true
when: mnt_services_check.rc == 0
- name: Clean /mnt/services directory
ansible.builtin.shell: find /mnt/services -mindepth 1 -maxdepth 1 -exec rm -rf {} \;
become: true
when: mnt_services_check.rc == 0 and not git_dir_check.stat.exists|default(false)
- name: Clone /mnt/services repository (initial clone)
ansible.builtin.git:
repo: "https://git.mvl.sh/vleeuwenmenno/services.git"
dest: "/mnt/services"
version: "main"
become: true
register: git_result
changed_when: git_result.changed
when: mnt_services_check.rc == 0 and not git_dir_check.stat.exists|default(false)
- name: Update /mnt/services repository (if already exists)
ansible.builtin.git:
repo: "https://git.mvl.sh/vleeuwenmenno/services.git"
dest: "/mnt/services"
@ -22,7 +44,7 @@
become: true
register: git_result
changed_when: git_result.changed
when: mnt_services_check.rc == 0
when: mnt_services_check.rc == 0 and git_dir_check.stat.exists|default(false)
- name: Ensure /mnt/services ownership to users
ansible.builtin.file: