Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rpm_packaging playbook runnable against RHEL9 targets #1872

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 2 additions & 49 deletions playbooks/rpm_packaging.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
---
- hosts: all
tasks:
- name: Install dependencies for packaging tooling
yum:
name: "{{ package_list }}"
state: present
vars:
package_list:
- git-core
- git-annex
- rubygem-nokogiri
- rpmspectool
- rubygem-gem2rpm
- make
- gcc
- redhat-rpm-config
- ruby-devel
- curl-devel
- gem
- python3-ruamel-yaml
- tito
- mock
- jq
- python3-pip
- wget
- vim
- python3-semver
become: true

- name: Install obal
pip:
name: obal
state: present
executable: pip3
become: true

- name: Clone foreman-packaging
git:
repo: https://github.com/theforeman/foreman-packaging.git
dest: /home/vagrant/foreman-packaging
version: rpm/develop

- name: Add vagrant user to mock group
user:
name: vagrant
groups: mock
append: true
become: true
...
roles:
- rpm_packaging
2 changes: 1 addition & 1 deletion roles/epel_repositories/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
epel_repositories_state: present
epel_repositories_flavor: "{{ 'epel-next-release' if ansible_distribution_major_version == '9' else 'epel-release' }}"
epel_repositories_flavor: "{{ 'epel-next-release' if ansible_distribution_major_version == '9' and ansible_distribution == 'CentOS' else 'epel-release' }}"
epel_repositories_url: https://dl.fedoraproject.org/pub/epel/{{ epel_repositories_flavor }}-latest-{{ ansible_distribution_major_version }}.noarch.rpm
epel_repositories_name: "{{ epel_repositories_url if (epel_repositories_state == 'present' and ansible_distribution == 'RedHat') else epel_repositories_flavor }}"
1 change: 1 addition & 0 deletions roles/git-annex/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git_annex_package: "{{ 'git-annex-standalone' if ansible_distribution == 'RedHat' else 'git-annex' }}"
17 changes: 17 additions & 0 deletions roles/git-annex/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: Set up EPEL
include_role:
name: epel_repositories
when: ansible_distribution != 'RedHat'

- name: Set up git-annex repository
yum_repository:
name: git-annex
description: git-annex
baseurl: https://downloads.kitenet.net/git-annex/linux/current/rpms/
gpgcheck: false
when: ansible_distribution == 'RedHat'

- name: Install git-annex
yum:
name: "{{ git_annex_package }}"
state: present
1 change: 1 addition & 0 deletions roles/rpm_packaging/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rpm_packaging_user: vagrant
4 changes: 4 additions & 0 deletions roles/rpm_packaging/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
dependencies:
- role: git-annex
- role: epel_repositories
2 changes: 2 additions & 0 deletions roles/rpm_packaging/tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Requirements:
- `community.general.gem` ansible collection
54 changes: 54 additions & 0 deletions roles/rpm_packaging/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
- name: Install dependencies for packaging tooling
yum:
name: "{{ package_list }}"
state: present
vars:
package_list:
- git-core
- rubygem-nokogiri
- make
- gcc
- redhat-rpm-config
- ruby-devel
- curl-devel
- gem
- python3-ruamel-yaml
- tito
- mock
- jq
- python3-pip
- wget
- vim
- python3-semver
become: true

- name: Install obal and rpmspectool
pip:
name: "{{ item }}"
state: present
executable: pip3
with_items:
- obal
- rpmspectool
become: true

- name: Install gem2rpm
gem:
name: gem2rpm
state: present
user_install: false
become: true

- name: Clone foreman-packaging
git:
repo: https://github.com/theforeman/foreman-packaging.git
dest: "/home/{{ rpm_packaging_user }}/foreman-packaging"
version: rpm/develop

- name: Add {{ rpm_packaging_user }} user to mock group
user:
name: "{{ rpm_packaging_user }}"
groups: mock
append: true
become: true