DEV Community

Query Filter
Query Filter

Posted on

docker35

- name: "RPM Promotion Logic"
  hosts: all
  vars:
    # Assuming this was set in your previous task
    discovered_version: "111-7cf39ab-leonid-comet-lse-migration"

  tasks:
    - name: "Step 1: Parse the branch name"
      set_fact:
        branch_name: "{{ discovered_version.split('-')[2:] | join('-') }}"

    - name: "Step 2: Locate the specific RPM"
      find:
        paths: "/tmp"
        # This will look for: *-leonid-comet-lse-migration.rpm
        patterns: "*-{{ branch_name }}.rpm"
      register: rpm_search

    - name: "Step 3: Use the found path for promotion"
      set_fact:
        target_rpm_path: "{{ rpm_search.files[0].path }}"
      when: rpm_search.matched > 0

    - name: "Debug Output"
      debug:
        msg: "Ready to promote: {{ target_rpm_path | default('No file found') }}"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)