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
Some checks failed
Nix Format Check / check-format (push) Failing after 38s
This commit is contained in:
parent
53aca071e4
commit
0a79d2f3e3
@ -12,7 +12,29 @@
|
|||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
become: 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:
|
ansible.builtin.git:
|
||||||
repo: "https://git.mvl.sh/vleeuwenmenno/services.git"
|
repo: "https://git.mvl.sh/vleeuwenmenno/services.git"
|
||||||
dest: "/mnt/services"
|
dest: "/mnt/services"
|
||||||
@ -22,7 +44,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: git_result
|
register: git_result
|
||||||
changed_when: git_result.changed
|
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
|
- name: Ensure /mnt/services ownership to users
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@ -31,4 +53,4 @@
|
|||||||
recurse: true
|
recurse: true
|
||||||
state: directory
|
state: directory
|
||||||
become: true
|
become: true
|
||||||
when: mnt_services_check.rc == 0
|
when: mnt_services_check.rc == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user