diff --git a/role-rocky-rss-feed.yml b/role-rocky-rss-feed.yml new file mode 100644 index 0000000..471108a --- /dev/null +++ b/role-rocky-rss-feed.yml @@ -0,0 +1,48 @@ +--- +# Preps a system to be a repository +- name: Configure RSS Feeds + hosts: all + become: true + vars_files: + - vars/common.yml + - vars/repopool.yml + - vars/mounts/srpmproc.yml + - vars/rss.yml + + handlers: + - import_tasks: handlers/main.yml + + pre_tasks: + - name: Check if ansible cannot be run here + stat: + path: /etc/no-ansible + register: no_ansible + + - name: Verify if we can run ansible + ansible.builtin.assert: + that: + - "not no_ansible.stat.exists" + success_msg: "We are not able to run on this node" + fail_msg: "/etc/no-ansible exists - skipping run on this node" + + tasks: + - name: "Setup shared filesystem mount" + include_tasks: tasks/efs_mount.yml + with_items: "{{ mounts }}" + tags: + - koji_efs_mount + + - name: Configure RSS feeds + import_tasks: tasks/rss.yml + tags: + - rss + + post_tasks: + - name: Touching run file that ansible has ran here + ansible.builtin.file: + path: /var/log/ansible.run + state: touch + mode: '0644' + owner: root + group: root +... diff --git a/tasks/rss.yml b/tasks/rss.yml new file mode 100644 index 0000000..151dbac --- /dev/null +++ b/tasks/rss.yml @@ -0,0 +1,22 @@ +--- +- name: Ensure docroot actually exists + ansible.builtin.file: + path: "{{ feeds_output_dir }}" + state: directory + +- name: Generate repo file for RSS feed data + ansible.builtin.template: + src: "etc/yum.repos.d/rss.repo.j2" + dest: "/etc/yum.repos.d/rss.repo" + owner: root + group: root + mode: '0644' + +- name: Deploy the generator script + ansible.builtin.template: + src: "usr/libexec/rocky/rss.sh.j2" + dest: "/usr/libexec/rocky/rss.sh.j2" + owner: root + group: root + mode: '0755' +... diff --git a/templates/etc/yum.repos.d/rss.repo.j2 b/templates/etc/yum.repos.d/rss.repo.j2 new file mode 100644 index 0000000..0e4121c --- /dev/null +++ b/templates/etc/yum.repos.d/rss.repo.j2 @@ -0,0 +1,12 @@ +# This is for RSS feeds only. Do not enable any of these repositories. +{% for repo in repo_tracking %} +{% for arch in repo.arch %} +{% for repository in repo.repositories %} +[rl{{ repo.release }}-{{ arch }}-{{ repository }}] +name=Rocky Linux {{ repo.release }} {{ arch }} {{ repository }} +baseurl=https://dl.rockylinux.org/{{ repo.contentdir }}/{{ repo.release }}/{{ repository }}/{{ arch }}/ +enabled=0 + +{% endfor %} +{% endfor %} +{% endfor %} diff --git a/templates/usr/libexec/rocky/rss.sh.j2 b/templates/usr/libexec/rocky/rss.sh.j2 new file mode 100644 index 0000000..355348c --- /dev/null +++ b/templates/usr/libexec/rocky/rss.sh.j2 @@ -0,0 +1,12 @@ +#!/bin/bash +TARGET="{{ feeds_output_dir }}" +dnf clean all --enablerepo=\* > /dev/null 2>&1 + +{% for repo in repo_tracking %} +{% for arch in repo.arch %} +{% for repository in repo.repositories %} +/usr/libexec/rocky/rss.py --filename ${TARGET}/Rocky-Linux-{{ repo.release }}-{{ arch }}-{{ repository }}.xml --title "Rocky Linux {{ repo.release }} {{ arch }} {{ repository }}" --description "Recently updated packages for Rocky Linux {{ repo.release }} {{ arch }} {{ repository }}" -r 30 rl{{ repo.release }}-{{ arch }}-{{ repository }} > /dev/null 2>&1 + +{% endfor %} +{% endfor %} +{% endfor %} diff --git a/vars/rss.yml b/vars/rss.yml new file mode 100644 index 0000000..bc0e8f7 --- /dev/null +++ b/vars/rss.yml @@ -0,0 +1,37 @@ +--- +feeds_output_dir: "/mnt/repos-production/mirror/pub/feeds" + +repo_tracking: + - release: 8 + contentdir: "pub/rocky" + arch: + - x86_64 + - aarch64 + repositories: + - BaseOS + - AppStream + - PowerTools + - HighAvailability + - ResilientStorage + - RT + - NFV + - extras + - plus + - release: 9 + contentdir: "pub/rocky" + arch: + - x86_64 + - aarch64 + repositories: + - BaseOS + - AppStream + - CRB + - HighAvailability + - ResilientStorage + - RT + - NFV + - SAP + - SAPHANA + - extras + - plus +...