Skip to content
Snippets Groups Projects
Commit 8b3831d8 authored by jabertwo's avatar jabertwo
Browse files

mount drives automatically

parent d35ac144
No related branches found
No related tags found
No related merge requests found
- name: Ensure mount directories exist for non-root drives
ansible.builtin.file:
path: "{{ item.value.path }}"
state: directory
mode: '0755'
loop: "{{ lookup('dict', drives) }}"
when: drives is defined and item.value.fstype != "swap" and item.value.path != "/"
- name: Mount all drives (excluding swap)
ansible.builtin.mount:
path: "{{ item.value.path }}"
src: "UUID={{ item.value.uuid }}"
fstype: "{{ item.value.fstype }}"
state: mounted
loop: "{{ lookup('dict', drives) }}"
when: drives is defined and item.value.fstype != "swap"
- name: Enable swap partition
ansible.builtin.command:
cmd: "swapon UUID={{ item.value.uuid }}"
loop: "{{ lookup('dict', drives) }}"
when: drives is defined and item.value.fstype == "swap"
\ No newline at end of file
......@@ -29,6 +29,20 @@ administratorenteam:
- "3d"
- "jabertwo"
drives:
sda1:
uuid: 6278aa48-6fc9-4889-be5f-d168627141b8
path: /
fstype: ext4
sda2:
uuid: aae468a2-1090-48f6-97fc-7366a84462f0
path: none
fstype: swap
sdb1:
uuid: 9b1c727b-a836-4e2b-a6e8-ca8b5a8949a2
path: /mnt/data
fstype: btrfs
# Monitoring aktivieren
alert:
load:
......
......@@ -6,8 +6,9 @@
- hosts: all
remote_user: root
roles:
- { role: all/hostname, tags: common }
- { role: all/common, tags: common }
- { role: all/hostname, tags: hostname }
- { role: all/mount, tags: mount}
- { role: all/sysctl, tags: sysctl }
##################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment