feat: initial commit

This commit is contained in:
Simon Cornet 2026-04-07 16:43:41 +02:00
commit 369761fcb6
11 changed files with 167 additions and 93 deletions

41
tasks/config.yaml Normal file
View file

@ -0,0 +1,41 @@
---
# transform __nfs_mount['local_dir_path']
- name: "set variables"
ansible.builtin.set_fact:
__systemctl_unit_name: "{{ __nfs_mount['local_dir_path'][1:] | replace('-', '\\x2d') | replace('/', '-') }}"
# create local data folder
- name: "directory - create folder {{ __nfs_mount['local_dir_path'] }}"
ansible.builtin.file:
path: "{{ __nfs_mount['local_dir_path'] }}"
state: "directory"
owner: "{{ __nfs_mount['local_dir_owner'] | default('root') }}"
group: "{{ __nfs_mount['local_dir_group'] | default('root') }}"
mode: "{{ __nfs_mount['local_dir_mode'] | default('0775') }}"
# set systemd mount file
- name: "systemd - config - {{ __systemctl_unit_name }}.mount"
ansible.builtin.template:
src: "templates/systemd/mount.j2"
dest: "/etc/systemd/system/{{ __systemctl_unit_name }}.mount"
owner: "root"
group: "root"
mode: "0644"
# start service one time
- name: "systemd - service - start"
ansible.builtin.systemd:
name: "{{ __systemctl_unit_name }}.mount"
daemon_reload: true
state: "started"
enabled: true
# fix permissions local folder
- name: "directory - fix folder permissions {{ __nfs_mount['local_dir_path'] }}"
ansible.builtin.file:
path: "{{ __nfs_mount['local_dir_path'] }}"
state: "directory"
owner: "{{ __nfs_mount['local_dir_owner'] | default('root') }}"
group: "{{ __nfs_mount['local_dir_group'] | default('root') }}"
mode: "{{ __nfs_mount['local_dir_mode'] | default('0775') }}"