You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/setup_rpm_repo/tasks/main.yml

98 lines
2.8 KiB
YAML

- block:
- name: Install epel repo which is missing on rhel-7 and is needed for rpmfluff
include_role:
name: setup_epel
when:
- ansible_distribution in ['RedHat']
- ansible_distribution_major_version is version('7', '==')
- name: Include distribution specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
- default.yml
paths:
- "{{ role_path }}/vars"
- name: Install rpmfluff and deps
action: "{{ ansible_facts.pkg_mgr }}"
args:
name: "{{ rpm_repo_packages }}"
- name: Install rpmfluff from pip on RHEL 8 and later
pip:
name: rpmfluff
when:
- ansible_facts.distribution in ['RedHat', 'CentOS']
- ansible_facts.distribution_major_version is version('8', '>=')
- name: Copy script for creating a repo
copy:
src: create-repo.py
dest: /tmp/create-repo.py
mode: 0755
- name: Create RPMs and put them into a repo
shell: "{{ansible_python_interpreter}} /tmp/create-repo.py {{ ansible_architecture }}"
register: repo
- set_fact:
repodir: "{{ repo.stdout_lines[-1] }}"
- name: Install the repo
yum_repository:
name: "fake-{{ ansible_architecture }}"
description: "fake-{{ ansible_architecture }}"
baseurl: "file://{{ repodir }}"
gpgcheck: no
- name: Copy comps.xml file
copy:
src: comps.xml
dest: "{{ repodir }}"
register: repodir_comps
- name: Register comps.xml on repo
command: createrepo -g {{ repodir_comps.dest | quote }} {{ repodir | quote }}
- name: Create RPMs and put them into a repo (i686)
shell: "{{ansible_python_interpreter}} /tmp/create-repo.py i686"
register: repo_i686
- set_fact:
repodir_i686: "{{ repo_i686.stdout_lines[-1] }}"
- name: Install the repo (i686)
yum_repository:
name: "fake-i686"
description: "fake-i686"
baseurl: "file://{{ repodir_i686 }}"
gpgcheck: no
- name: Create RPMs and put them into a repo (ppc64)
shell: "{{ansible_python_interpreter}} /tmp/create-repo.py ppc64"
register: repo_ppc64
- set_fact:
repodir_ppc64: "{{ repo_ppc64.stdout_lines[-1] }}"
- name: Install the repo (ppc64)
yum_repository:
name: "fake-ppc64"
description: "fake-ppc64"
baseurl: "file://{{ repodir_ppc64 }}"
gpgcheck: no
- set_fact:
repos:
- "fake-{{ ansible_architecture }}"
- "fake-i686"
- "fake-ppc64"
when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux', 'Fedora']