2013-08-16 14:53:06 +00:00
|
|
|
# This playbook takes new rpms specified with a fileglob, signs them, and adds
|
|
|
|
# them to the infrastructure repo.
|
|
|
|
#
|
2014-02-09 22:43:22 +00:00
|
|
|
# To push to infra-testing:
|
2014-06-23 20:59:41 +00:00
|
|
|
# requires --extra-vars="rpmdir='/home/fedora/ralph/rpms/' testing=True rhel=6"
|
2014-02-09 22:43:22 +00:00
|
|
|
#
|
|
|
|
# To push to infra:
|
2014-06-23 20:59:41 +00:00
|
|
|
# requires --extra-vars="rpmdir='/home/fedora/ralph/rpms/' rhel=6"
|
2014-08-07 17:47:07 +02:00
|
|
|
#
|
|
|
|
# To push to fedora 20:
|
|
|
|
# requires --extra-vars="rpmdir='/home/fedora/ralph/rpms/' rhel=20"
|
|
|
|
#
|
2013-08-16 14:53:06 +00:00
|
|
|
|
|
|
|
# TODO -- grab rpms from koji build/task ids beforehand?
|
|
|
|
# TODO -- other arches than x86_64?
|
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
---
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Batch sign and import a directory full of rpms
|
2013-08-16 14:53:06 +00:00
|
|
|
user: root
|
2015-07-14 19:40:21 +00:00
|
|
|
hosts: localhost
|
2013-08-22 21:12:00 +00:00
|
|
|
connection: local
|
2013-08-16 14:53:06 +00:00
|
|
|
|
2013-09-06 13:59:35 +00:00
|
|
|
# Toggle this variable to import to the testing repo as opposed to the staging
|
|
|
|
# repo. Since we're in freeze right now, we'll default to the testing repo.
|
|
|
|
# It would be nice to be able to toggle this from the command line.
|
2013-09-06 13:57:54 +00:00
|
|
|
vars:
|
2014-06-23 20:59:41 +00:00
|
|
|
- repodir: /mnt/fedora/app/fi-repo/{% if testing %}testing/{% endif %}{{ rhel }}
|
2024-11-25 18:24:56 +10:00
|
|
|
- testing: false
|
2013-09-06 13:57:54 +00:00
|
|
|
|
2013-08-16 14:53:06 +00:00
|
|
|
tasks:
|
2016-09-25 17:28:29 +00:00
|
|
|
- fail: msg="Please use the infra tags from now on"
|
|
|
|
when: no_use_infratags is not defined
|
|
|
|
|
2014-06-23 21:05:58 +00:00
|
|
|
- fail: msg="Please specify rhel version with rhel=6/7"
|
|
|
|
when: rhel is not defined
|
|
|
|
|
2013-08-22 21:12:00 +00:00
|
|
|
- name: Fail if no rpmdir provided
|
|
|
|
fail: msg="No rpmdir provided"
|
|
|
|
when: rpmdir is not defined
|
|
|
|
# TODO -- I'd also like to fail if rpmdir does not exist.
|
|
|
|
# TODO -- I'd also like to fail if there are no *.rpm files in there.
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Sign all the rpms with our gpg key
|
2024-12-19 16:42:30 +10:00
|
|
|
ansible.builtin.shell: /bin/rpm --resign {{ rpmdir }}/*.rpm
|
2013-08-22 21:12:00 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Make a directory where we store the rpms afterwards
|
2024-12-17 15:31:55 +10:00
|
|
|
ansible.builtin.file: path={{ rpmdir }}-old state=directory
|
2013-08-22 21:12:00 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy the source rpms to the SRPMS dir of {{ repodir }}
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src={{ item }} dest={{ repodir }}/SRPMS/
|
2014-01-01 20:12:53 +00:00
|
|
|
with_fileglob:
|
2024-11-25 18:24:56 +10:00
|
|
|
- "{{ rpmdir }}/*.src.rpm"
|
2013-08-16 14:53:06 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Move processed srpms out to {{ rpmdir }}-old
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: /bin/mv {{ item }} {{ rpmdir }}-old/
|
2014-02-13 21:51:02 +01:00
|
|
|
when: not testing
|
2014-01-01 20:12:53 +00:00
|
|
|
with_fileglob:
|
2024-11-25 18:24:56 +10:00
|
|
|
- "{{ rpmdir }}/*.src.rpm"
|
2013-08-16 14:53:06 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy the binary rpms to the x86_64 dir of {{ repodir }}
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src={{ item }} dest={{ repodir }}/x86_64/
|
2014-01-01 20:12:53 +00:00
|
|
|
with_fileglob:
|
2024-11-25 18:24:56 +10:00
|
|
|
- "{{ rpmdir }}/*.rpm"
|
2013-08-16 14:53:06 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy the binary rpms to the i386 dir of {{ repodir }}
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src={{ item }} dest={{ repodir }}/i386/
|
2014-04-01 15:12:31 +00:00
|
|
|
with_fileglob:
|
2024-11-25 18:24:56 +10:00
|
|
|
- "{{ rpmdir }}/*.rpm"
|
2013-08-16 14:53:06 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Move processed rpms out to {{ rpmdir }}-old
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: /bin/mv {{ item }} {{ rpmdir }}-old/
|
2014-02-13 21:51:02 +01:00
|
|
|
when: not testing
|
2014-01-01 20:12:53 +00:00
|
|
|
with_fileglob:
|
2024-11-25 18:24:56 +10:00
|
|
|
- "{{ rpmdir }}/*.rpm"
|
2014-04-01 15:12:31 +00:00
|
|
|
|
|
|
|
- name: Run createrepo on each repo
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: createrepo --update {{ repodir }}/{{ item }}/
|
2014-04-01 15:12:31 +00:00
|
|
|
with_items:
|
|
|
|
- SRPMS
|
|
|
|
- x86_64
|
|
|
|
- i386
|