ansible-koji/roles/nfs_server/tasks/main.yaml
Rénich Bon Ćirić be9438afdf
feat: automate CentOS Stream 10 repository mirroring setup
Add configurations to playbooks and templates for local repository mirroring.
This exports and mounts the CentOS Stream 10 local mirror directory (/srv/nfs/cs10),
deploys the Apache configuration serving it from the Hub, and parameters the Koji
external repository bootstrap tasks to synchronize target URLs with local mirrors.

Co-developed-by: Gemini AI <renich+gemini@woralelandia.com>
Signed-off-by: Rénich Bon Ćirić <renich@woralelandia.com>
2026-06-16 13:48:55 -06:00

65 lines
1.6 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: Ensure Koji Admin user exists
ansible.builtin.user:
name: "{{ koji_admin_user }}"
state: present
create_home: true
- name: Create the Koji mirror directory to be exported
ansible.builtin.file:
path: "{{ koji_mirror_dir }}"
state: directory
owner: "{{ koji_admin_user }}"
group: "{{ koji_admin_user }}"
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 }}"
state: present
mode: "0644"
loop: "{{ groups['all'] }}"
- name: Configure the NFS export for all Koji nodes
ansible.builtin.template:
src: exports.j2
dest: /etc/exports
owner: root
group: root
mode: "0644"
# This command does not provide a reliable way to determine if the NFS exports were changed,
# so we run it on every execution.
- name: Export all NFS filesystems
ansible.builtin.command: exportfs -ra
changed_when: false
- 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