add initial rss playbooks

This commit is contained in:
Louis Abel 2023-09-04 23:44:53 -07:00
parent 82e3c77caa
commit 19b0a1206f
Signed by: label
GPG Key ID: 3331F061D1D9990E
5 changed files with 131 additions and 0 deletions

48
role-rocky-rss-feed.yml Normal file
View File

@ -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
...

22
tasks/rss.yml Normal file
View File

@ -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'
...

View File

@ -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 %}

View File

@ -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 %}

37
vars/rss.yml Normal file
View File

@ -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
...