/
/
/
Ansible role that deployss my nas configuration. It mostly handles nfs configurations and exports that are tailored to the hardware and service configuration.
1---
2- name: Include OS-specific variables
3 include_vars: "{{ ansible_os_family | lower }}.yml"
4 ignore_errors: true
5
6- name: Log NAS role execution start
7 debug:
8 msg: "Starting NAS role configuration for {{ inventory_hostname }}"
9
10# Package Installation
11- name: Install NAS packages
12 package:
13 name: "{{ nas_install_packages }}"
14 state: present
15 become: true
16 notify: restart nfs services
17
18# Network Bonding Configuration
19- name: Configure network bonding
20 include_tasks: bonding.yml
21 when: nas_network_bonding_enabled | bool
22
23# RAID Configuration (DISABLED - Manual Management)
24# Note: RAID arrays are assumed to be manually configured and mounted
25
26# Storage Management (Subdirectories Only)
27- name: Verify storage mount exists and create subdirectories
28 include_tasks: mounts.yml
29
30# Docker Boot Ordering (prevents containers binding a not-yet-mounted array)
31- name: Ensure docker starts after the storage array is mounted
32 include_tasks: docker-mount-ordering.yml
33 when: nas_docker_mount_ordering_enabled | bool
34 tags: ['storage', 'docker', 'boot-ordering']
35
36# Performance Tuning
37- name: Apply performance tuning
38 include_tasks: performance.yml
39 when: nas_performance_tuning_enabled | bool
40
41# NFS Server Configuration
42- name: Configure NFS server
43 include_tasks: nfs.yml
44 when: nas_nfs_enabled | bool
45
46# Monitoring Setup
47- name: Configure monitoring
48 include_tasks: monitoring.yml
49 when: nas_monitoring_enabled | bool
50
51
52# Backup Integration
53- name: Configure backup integration
54 include_tasks: backup.yml
55 when: nas_backup_integration | bool
56
57- name: Ensure all NAS services are started and enabled
58 systemd:
59 name: "{{ item }}"
60 state: started
61 enabled: true
62 loop: "{{ nas_services }}"
63 become: true
64
65- name: Log NAS role execution completion
66 debug:
67 msg: "NAS role configuration completed successfully for {{ inventory_hostname }}"