ansible-koji/roles/nfs_client/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

64 lines
1.7 KiB
YAML

# SPDX-License-Identifier: MIT-0
---
- name: Install NFS client packages
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- nfs-utils
- nfs4-acl-tools
- policycoreutils-python-utils
- name: Create mount point directory
ansible.builtin.file:
path: "{{ koji_top_dir }}"
state: directory
mode: "0755"
- name: Add NFS server to /etc/hosts
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ hostvars[groups['kojifs'][0]].ansible_default_ipv4.address }} {{ koji_nfs_host }}"
state: present
mode: "0644"
- name: Mount the Koji NFS share
ansible.posix.mount:
path: "{{ koji_top_dir }}"
src: "{{ koji_nfs_host }}:{{ koji_top_dir }}"
fstype: nfs
opts: "rw,sync"
state: mounted
- name: Create mirror mount point directory
ansible.builtin.file:
path: "{{ koji_mirror_dir }}"
state: directory
owner: "{{ koji_admin_user }}"
group: "{{ koji_admin_user }}"
mode: "0755"
when: inventory_hostname in groups['kojihub']
- name: Mount the Koji Mirror NFS share
ansible.posix.mount:
path: "{{ koji_mirror_dir }}"
src: "{{ koji_nfs_host }}:{{ koji_mirror_dir }}"
fstype: nfs
opts: "rw,sync"
state: mounted
when: inventory_hostname in groups['kojihub']
- name: Set SELinux context for Koji NFS mount
ansible.builtin.command: semanage fcontext -a -t nfs_t "{{ koji_top_dir }}(/.*)?"
changed_when: false
check_mode: false
- name: Apply SELinux context
ansible.builtin.command: restorecon -R "{{ koji_top_dir }}"
changed_when: false
check_mode: false
- name: Flush systemd journal to disk
ansible.builtin.command: journalctl --flush
changed_when: false
check_mode: false