DEV Community

Query Filter
Query Filter

Posted on

docker47

- name: "LOGIC: EXTRACT METADATA FROM RPM FILENAME"
  ansible.builtin.set_fact:
    # We define the basename variable once to make the rest cleaner
    _filename: "{{ found_rpms.files[0].path | basename }}"

    manifest_data: "{{ remote_manifest.content | b64decode | from_json }}"

    # Extraction logic applied to the first file only
    app_architecture: "{{ _filename | regex_replace('^.*\\.([^.]+)\\.rpm$', '\\1') }}"
    app_version: "{{ _filename | regex_replace('^.*-([^-]+)\\.[^.]+\\.rpm$', '\\1') }}"
    app_prefix: "{{ _filename | regex_replace('-' + (_filename | regex_replace('^.*-([^-]+)\\.[^.]+\\.rpm$', '\\1')) + '\\..*', '') }}"
  when: found_rpms.matched > 0
Enter fullscreen mode Exit fullscreen mode

Top comments (0)