This commit is contained in:
aynic.os
2021-07-14 23:58:24 +01:00
parent b6f1b8d798
commit da2f3ed44a
40 changed files with 166 additions and 108 deletions
+2 -6
View File
@@ -22,7 +22,7 @@ disks_to_mount:
- disk: /dev/sdb
fstype: ext4
mount_options: defaults
mount: /data
mount: /data1
user: www-data
group: www-data
disable_periodic_fsck: false
@@ -31,14 +31,10 @@ disks_to_mount:
fstype: xfs
mount_options: defaults,noatime
mount: /data2
- device_name: /dev/sdf
fstype: ext4
mount_options: defaults
mount: /data
- disk: nfs-host:/nfs/export
fstype: nfs
mount_options: defaults,noatime
mount: /srv/nfs
mount: /data3
```
The following filesystems are currently supported:
@@ -1,25 +1,3 @@
---
# file: tasks/filesystems-btrfs.yml
- name: filesystems-btrfs - create filesystem on the first partition
when: item.1.stat.exists
with_together:
- '{{ disks_to_mount }}'
- '{{ disks_stat.results }}'
filesystem:
dev: '{{ item.0.part | default(item.0.disk + "1") }}'
force: '{{ item.0.force|d(omit) }}'
fstype: '{{ item.0.fstype }}'
opts: '{{ item.0.fsopts|d(omit) }}'
become: yes
- name: filesystems-btrfs - disable periodic fsck and reserved space on ext3 or ext4 formatted disks
when: "disks_to_mount and ( item.0.fstype == 'ext4' or item.0.fstype == 'ext3' ) and item.0.disable_periodic_fsck|default(false)|bool and item.1.stat.exists"
with_together:
- '{{ disks_to_mount }}'
- '{{ disks_stat.results }}'
environment:
PATH: "{{ ansible_env.PATH }}:/usr/sbin:/sbin"
shell: tune2fs -c0 -i0 -m0 {{ item.0.part | default(item.0.disk + "1") }}
become: yes
+1 -1
View File
@@ -2,7 +2,7 @@
# file: tasks/packages.yml
- name: packages - install parted
when: disks_to_mount
when: disks_to_mount is defined
package:
name: parted
state: present
+2 -2
View File
@@ -2,7 +2,7 @@
# file: tasks/services.yml
- name: services - enable/disable disks services
when: ansible_service_mgr|lower != "openrc"
when: disks_services is defined and ansible_service_mgr|lower != "openrc"
with_items: "{{ disks_services|default([]) }}"
service:
name: "{{item.name}}"
@@ -11,7 +11,7 @@
become: yes
- name: services - openrc - enable/disable disks services
when: ansible_service_mgr|lower == "openrc"
when: disks_services is defined and ansible_service_mgr|lower == "openrc"
with_items: "{{ disks_services|default([]) }}"
service:
name: "{{item.name}}"