new file: roles/host_maintenance/README.md
image-deploy.yaml / build-push-image (push) Successful in 47s

modified:   roles/host_maintenance/tasks/systemd_mount.yaml
modified:   roles/host_maintenance/templates/systemd_mount.j2
This commit is contained in:
Márcio Fernandes committed 2026-10-13 22:12:26 +00:00
1 parent c187d56137
commit 4a8ce0e3bd
3 files changed
+42 -5

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
systemd_mount vars task example:
``` yaml
host_maintenance_disk_mounts:
- source: /dev/disk/by-uuid/xxxxxxx
target: /var/lib/rancher
mount_type: ext4
unit_before: k3s.service
unit_conflicts: umount.target
mount_options:
- defaults
- source: /dev/disk/by-uuid/xxxxx
target: /var/lib/rancher/k3s/storage
unit_before: k3s.service
unit_conflicts: umount.target
mount_type: ext4
mount_options:
- defaults
```
@@ -1,7 +1,11 @@
#vars:
# host_maintenance_systemd_mount_target: ""
# host_maintenance_systemd_mount_source: ""
- ansible.builtin.assert:
that:
- item.source is defined
- item.target is defined
- item.mount_type is defined
fail_msg: "All of source, target, and mount_type must be defined for each disk entry."
loop: "{{ host_maintenance_disk_mounts }}"
- name: check target folders
ansible.builtin.file:
path: "{{ item.target }}"
@@ -1,14 +1,26 @@
# set by ansible role mylimbo.globals.host_maintenance role, do not edit manually
[Unit]
Description=Mount {{ item.target }} managed by mylimbo.globals collections, host_maintenance role
#After=
Conflicts={{ item.unit_conflicts }}
{% if item.unit_after is defined %}
# After dependencies
After={{ item.unit_after }}
{% endif %}
{% if item.unit_before is defined %}
# Before dependencies
Before={{ item.unit_before }}
{% endif %}
[Mount]
What={{ item.source }}
Where={{ item.target }}
Type={{ item.mount_type }}
{% if item.mount_options is defined %}
# Mount options, if specified
Options={{ item.mount_options | join(',') }}
{% endif %}
[Install]
WantedBy=multi-user.target