Some checks failed
Nix Format Check / check-format (push) Failing after 38s
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
- name: Ensure server common packages are installed
|
|
ansible.builtin.package:
|
|
name:
|
|
- openssh-server
|
|
state: present
|
|
become: true
|
|
|
|
- name: Check if /mnt/services is a mount point
|
|
ansible.builtin.shell: mountpoint -q /mnt/services || echo "not_mounted"
|
|
register: mnt_services_check
|
|
changed_when: false
|
|
ignore_errors: true
|
|
become: true
|
|
|
|
- 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"
|
|
update: true
|
|
version: "main"
|
|
force: true
|
|
become: true
|
|
register: git_result
|
|
changed_when: git_result.changed
|
|
when: mnt_services_check.rc == 0 and git_dir_check.stat.exists|default(false)
|
|
|
|
- name: Ensure /mnt/services ownership to users
|
|
ansible.builtin.file:
|
|
path: "/mnt/services"
|
|
group: "users"
|
|
recurse: true
|
|
state: directory
|
|
become: true
|
|
when: mnt_services_check.rc == 0
|