Add script and tst.yml playbook to easily import the platform module.

This commit is contained in:
James Antill
2021-05-24 02:05:22 -04:00
parent c5f1e48559
commit c124205f0b
7 changed files with 55 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
## Ansible Role: mbs
This mbs role is used in the CentOS Infra.
This mbs role is used in the CentOS Infra. ( mbs.stream.rdu2.redhat.com )
Based off of https://pagure.io/fedora-infra/ansible/blob/main/f/roles/mbs/common
etc.
It surely depends (see dependencies below) on some other roles.

View File

@@ -1,5 +1,6 @@
---
# defaults file for mbs
mbs_platform_url: "https://gitlab.com/redhat/centos-stream/modules/platform/-/raw/el9/platform.yaml"
mbs_buildtools_repo_gpgkey: "{{ kojid_buildtools_repo_gpgkey | default('') }}"
mbs_env: "{{ centos_infra_env | default('prod') }}"
mbs_frontend: True

8
tasks/local.yml Normal file
View File

@@ -0,0 +1,8 @@
# Do things locally
- name: create mbs script to install default platform
template:
src: mbs/mbs-install-platform.sh.j2
dest: /tmp/mbs-install-platform.sh
mode: 0755
delegate_to: localhost

View File

@@ -1,5 +1,6 @@
---
# base system setup
- include_tasks: local.yml
- include_tasks: system.yml
# rabbitmq
- include_tasks: rabbitmq.yml

View File

@@ -138,6 +138,11 @@
changed_when: "'Running upgrade' in mbs_db_output.stdout"
failed_when: mbs_db_output.rc != 0
- name: Download default platform module
get_url:
url: "{{ mbs_platform_url }}"
dest: /etc/module-build-service/default-modules/
- block:
- name: Import default modules
copy:

View File

@@ -0,0 +1,26 @@
#! /bin/sh -e
mbsplaturl='{{ mbs_platform_url }}'
echo "Getting: $mbsplaturl"
case "$1" in
download)
rm -f "$(basename $mbsplaturl)"
curl -O $mbsplaturl
echo "Run: /usr/bin/mbs-manager import_module $(basename $mbsplaturl)"
;;
install)
tmp_dir=$(mktemp -d -t mbsi-XXXXXXXXXX)
cd $tmp_dir
curl -O $mbsplaturl
/usr/bin/mbs-manager import_module $(basename $mbsplaturl)
rm -rf $tmp_dir
;;
*)
echo "$0: download | install"
;;
esac

10
tst.yml Normal file
View File

@@ -0,0 +1,10 @@
---
- name: Local test to get the mbs-install-platform.sh file in /tmp
connection: ansible.netcommon.network_cli
gather_facts: false
hosts: localhost
vars_files:
- defaults/main.yml
tasks:
- include_tasks: tasks/local.yml