netz39-infra-ansible/roles/nfs_host/tasks/main.yml
Alexander Dahl 8b2ab7753d 🚨 Fix linter warnings of type 'name[casing]'
ansible-lint reads like this:

    name[casing]: All names should start with an uppercase letter.

While at it: Some task/handler names were slightly adapted to better
match what should be done.
2025-03-01 21:21:22 +01:00

41 lines
982 B
YAML

---
- name: Install required packages
ansible.builtin.apt:
state: present
name:
- nfs-kernel-server
- nfs-common
- parted
- name: Create a new ext4 primary partition
community.general.parted:
device: "{{ nfs_host_storage_device }}"
number: 1
state: present
fs_type: ext4
- name: Ensure nfs mountpoints exist
ansible.builtin.file:
path: "{{ item.directory }}"
state: directory
owner: nobody
group: nogroup
mode: '0777'
with_items: "{{ nfs_host_exports }}"
- name: Mount up device by label
ansible.posix.mount:
path: "{{ nfs_host_exports[0].directory }}"
src: /dev/sdb1
fstype: ext4
state: present
- name: Put /etc/exports in place from template
ansible.builtin.template:
src: templates/exports.j2
dest: "/etc/exports"
notify: Reload nfs
- name: Ensure nfs is running.
ansible.builtin.service: "name=nfs-kernel-server state=started enabled=yes"
when: nfs_host_exports|length