Blob Blame History Raw
- hosts: localhost
  gather_facts: false
  vars_prompt:
    - name: "koji_profile"
      prompt: "Which koji instance do you want to configure ? [ex: mbox] "
      private: no

  tasks:
    - name: "Loading first variables for koji instance {{ koji_profile }}"
      include_vars:
        file: "vars/{{ koji_profile}}.yml"
      tags:
        - inheritance

    - name: "Creating first default tags for inheritance on [{{ koji_profile }}] koji instance"
      koji_tag:
        koji: "{{ koji_profile }}"
        name: "{{ item.name }}"
        arches: "{{ koji_arches }}"
        state: present   
      with_items: "{{ default_tag_inheritance_list }}"
      loop_control:
        label: "{{ item.name }}"
     
    - name: "Creating needed build tags for targets on [{{ koji_profile }}] koji instance"
      koji_tag:
        koji: "{{ koji_profile }}"
        name: "{{ item.build_tag }}"
        arches: "{{ koji_arches }}"
        state: present   
      with_items: "{{ koji_targets }}"
      loop_control:
        label: "{{ item.build_tag }} => {{ item.name }}"
    
    - name: "Creating needed dest tags for targets on [{{ koji_profile }}] koji instance"
      koji_tag:
        koji: "{{ koji_profile }}"
        name: "{{ item.dest_tag }}"
        arches: "{{ koji_arches }}"
        state: present   
      with_items: "{{ koji_targets }}"
      loop_control:
        label: "{{ item.dest_tag }} => {{ item.name }}"
 
    - name: "Creating koji targets on on [{{ koji_profile }}] koji instance"
      koji_target:
        koji: "{{ koji_profile }}"
        name: "{{ item.name }}"
        build_tag: "{{ item.build_tag }}"
        dest_tag: "{{ item.dest_tag }}"
      with_items: "{{ koji_targets }}"  
      loop_control:
        label: "{{ item.name }}"

    - name: "Adding inheritance when needed"
      koji_tag_inheritance:
        koji: "{{ koji_profile }}"
        parent_tag: "{{ item.1.name }}"
        child_tag: "{{ item.0.name }}"
        priority: "{{ item.1.priority }}"
      with_subelements:
        - "{{ koji_build_tags }}"
        - inheritance_list
      loop_control:
        label: "{{ item.1.name }} => {{ item.0.name }}"
      tags:
        - inheritance