ansible-koji/roles/nfs-server/tasks/main.yaml

49 lines
1.2 KiB
YAML

#SPDX-License-Identifier: MIT-0
---
- name: Install NFS server packages
ansible.builtin.dnf:
name: nfs-utils
state: present
- name: Create the Koji top directory to be exported
ansible.builtin.file:
path: "{{ koji_top_dir }}"
state: directory
owner: nobody
group: nobody
mode: "0755"
- name: Add Koji nodes to /etc/hosts on NFS server
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}"
create: true
state: present
loop: "{{ groups['koji_nodes'] }}"
- name: Configure the NFS export for all Koji nodes
ansible.builtin.template:
src: exports.j2
dest: /etc/exports
owner: root
group: root
mode: "0644"
- name: Export all NFS filesystems
ansible.builtin.command: exportfs -ra
changed_when: true
- name: Start and enable NFS services
ansible.builtin.service:
name: "{{ item }}"
state: started
enabled: true
loop: ["rpcbind", "nfs-server"]
- name: Open firewall for NFS
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
state: enabled
loop: ["nfs", "rpc-bind", "mountd"]
notify: Reload firewalld