Radek Vykydal 147131
---
Radek Vykydal 147131
Radek Vykydal 147131
### Set up local facts from system repositories
Radek Vykydal 147131
Radek Vykydal 147131
- name: Create facts directory for repository custom facts
Radek Vykydal 147131
  file:
Radek Vykydal 147131
    state: directory
Radek Vykydal 147131
    recurse: yes
Radek Vykydal 147131
    path: /etc/ansible/facts.d
Radek Vykydal 147131
Radek Vykydal 147131
- name: Install base repository facts
Radek Vykydal 147131
  copy:
Radek Vykydal 147131
    remote_src: yes
Radek Vykydal 147131
    src: "/etc/yum.repos.d/{{ base_repo_from_runner.file }}"
Radek Vykydal 147131
    dest: "/etc/ansible/facts.d/{{ base_repo_from_runner.file}}.fact"
Radek Vykydal 147131
  when: base_repo_command is not defined and base_repo_from_runner is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Install additional repositories facts
Radek Vykydal 147131
  copy:
Radek Vykydal 147131
    remote_src: yes
Radek Vykydal 147131
    src: "/etc/yum.repos.d/{{ item.file }}"
Radek Vykydal 147131
    dest: "/etc/ansible/facts.d/{{ item.file}}.fact"
Radek Vykydal 147131
  with_items: "{{ repos_from_runner }}"
Radek Vykydal 147131
  when: repo_commands is not defined and repos_from_runner is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Setup repository facts
Radek Vykydal 147131
  setup:
Radek Vykydal 147131
    filter: ansible_local
Radek Vykydal 147131
Radek Vykydal 147131
### Base repository
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set base installation repository from system base metalink repository
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    base_repo_command: "url --metalink={{ ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['metalink'] }}"
Radek Vykydal 147131
  when: ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['metalink'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set base installation repository from system base mirrorlist repository
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    base_repo_command: "url --mirrorlist={{ ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['mirrorlist'] }}"
Radek Vykydal 147131
  when: ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['mirrorlist'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set base installation repository from system base url repository
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    base_repo_command: "url --url={{ ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['baseurl'] }}"
Radek Vykydal 147131
  when: ansible_local[base_repo_from_runner.file][base_repo_from_runner.repo]['baseurl'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
### Additional repositories
Radek Vykydal 147131
Radek Vykydal 147131
- name: Look for system metalink repositories
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repos_metalink: "{{ repos_metalink | default([]) + [ 'repo --name=' + item.repo + ' --metalink=' + ansible_local[item.file][item.repo]['metalink'] ] }}"
Radek Vykydal 147131
    #ignore_errors: true
Radek Vykydal 147131
  with_items: "{{ repos_from_runner }}"
Radek Vykydal 147131
  when: repo_commands is not defined and ansible_local[item.file][item.repo]['metalink'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Look for system mirrorlist repositories
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repos_mirrorlist: "{{ repos_mirrorlist | default([]) + [ 'repo --name=' + item.repo + ' --mirrorlist=' + ansible_local[item.file][item.repo]['mirrorlist'] ] }}"
Radek Vykydal 147131
    #ignore_errors: true
Radek Vykydal 147131
  with_items: "{{ repos_from_runner }}"
Radek Vykydal 147131
  when: repo_commands is not defined and ansible_local[item.file][item.repo]['mirrorlist'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Look for system baseurl repositories
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repos_baseurl: "{{ repos_baseurl | default([]) + [ 'repo --name=' + item.repo + ' --baseurl=' + ansible_local[item.file][item.repo]['baseurl'] ] }}"
Radek Vykydal 147131
    #ignore_errors: true
Radek Vykydal 147131
  with_items: "{{ repos_from_runner }}"
Radek Vykydal 147131
  when: repo_commands is not defined and ansible_local[item.file][item.repo]['baseurl'] is defined
Radek Vykydal 147131
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set additional metalink installation repositories from system
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repo_commands: "{{ repo_commands | default([]) + [ item ] }}"
Radek Vykydal 147131
  with_items: "{{ repos_metalink }}"
Radek Vykydal 147131
  when: repos_metalink is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set additional mirrorlist installation repositories from system
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repo_commands: "{{ repo_commands | default([]) + [ item ] }}"
Radek Vykydal 147131
  with_items: "{{ repos_mirrorlist }}"
Radek Vykydal 147131
  when: repos_mirrorlist is defined
Radek Vykydal 147131
Radek Vykydal 147131
- name: Set additional baseurl installation repositories from system
Radek Vykydal 147131
  set_fact:
Radek Vykydal 147131
    repo_commands: "{{ repo_commands | default([]) + [ item ] }}"
Radek Vykydal 147131
  with_items: "{{ repos_baseurl }}"
Radek Vykydal 147131
  when: repos_baseurl is defined