diff --git a/all/mount/tasks/main.yml b/all/mount/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..eee037b130292b5b3b2263dd55b944f42c45fa93 --- /dev/null +++ b/all/mount/tasks/main.yml @@ -0,0 +1,22 @@ +- 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 diff --git a/host_vars/weatherwax b/host_vars/weatherwax index ba01efc484ce4fd17c3708a8f9459f08680d4608..d283bf7595f49a195b5d5ed9bc551783340edd42 100644 --- a/host_vars/weatherwax +++ b/host_vars/weatherwax @@ -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: diff --git a/site.yml b/site.yml index 8b2373b7aa6a080dae101c76c3a21c3ab0a16898..b08e55951cca18adf361b5d220fc80201803350e 100644 --- a/site.yml +++ b/site.yml @@ -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 } ##################################################