Files
ansible.collection.globals/roles/host_maintenance/tasks/systemd_mount.yaml
T
Márcio Fernandes 4a8ce0e3bd
image-deploy.yaml / build-push-image (push) Successful in 47s
new file: roles/host_maintenance/README.md
modified:   roles/host_maintenance/tasks/systemd_mount.yaml
modified:   roles/host_maintenance/templates/systemd_mount.j2
2026-10-13 22:12:26 +00:00

32 lines
1014 B
YAML

- 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 }}"
state: directory
mode: '0755'
loop: "{{ host_maintenance_disk_mounts }}"
- name: set systemd mount
ansible.builtin.template:
src: templates/systemd_mount.j2
dest: "/etc/systemd/system/{{ item.target | regex_replace('^/', '') | regex_replace('/', '-') }}.mount"
mode: '0644'
loop: "{{ host_maintenance_disk_mounts }}"
register: systemd_mount_files
- name: reload systemd
ansible.builtin.systemd_service:
name: "{{ item.target | regex_replace('^/', '') | regex_replace('/', '-') }}.mount"
daemon_reload: "{{ systemd_mount_files.changed }}"
enabled: true
state: started
loop: "{{ host_maintenance_disk_mounts }}"