36 lines
855 B
YAML
36 lines
855 B
YAML
|
- name: Install packages
|
||
|
ansible.builtin.apt:
|
||
|
name: "{{ item }}"
|
||
|
state: present
|
||
|
install_recommends: false
|
||
|
loop: "nfs-kernel-server rpcbind"
|
||
|
|
||
|
- name: Check the disk for existing partitions
|
||
|
ansible.builtin.stat:
|
||
|
path: "{{ storage_disk }}1"
|
||
|
register: partition_exists
|
||
|
|
||
|
- name: Format disk
|
||
|
community.general.filesystem:
|
||
|
fstype: "{{ fs_type }}"
|
||
|
dev: "{{ storage_disk }}"
|
||
|
when: not partition_exists
|
||
|
|
||
|
- name: Create mount
|
||
|
ansible.builtin.template:
|
||
|
src: etc-systemd-system-mnt-storage.mount.j2
|
||
|
dest: "/etc/systemd/system/mnt-{{ mount_path }}.mount"
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Enable mount
|
||
|
ansible.builtin.systemd_service:
|
||
|
name: "mnt-{{ mount_path }}.mount"
|
||
|
state: started
|
||
|
enabled: true
|
||
|
|
||
|
- name: Setup nfs-server
|
||
|
ansible.builtin.template:
|
||
|
src: etc-exports.j2
|
||
|
dest: /etc/exports
|
||
|
mode: "0644"
|