
docker25
--- # 1. First, find the physical RPM file in the migration directory - name : " Discovery: Find the RPM file in the migration directory" ansible.builtin.find : paths : " /tmp/{{ lightspeed.build_version }}" patterns : " *.rpm" register : found_rpms # 2. Extract the Version (e.g., 1.0.0) from the filename dynamically - name : " Logic: Extract naming metadata from filename" ansible.builtin.set_fact : # This regex captures the version string between the hyphen and the arch suffix app_version : " {{ (found_rpms.files[0].path | basename | regex_search('^(.*)-(.*) \\ .x86_64 \\ .rpm$', ' \\ 2'))[0] }}" when : found_rpms.matched > 0 # 3. Install using the discovered path - name : " Install RPM package in the Linux servers" ansible.builtin.yum : name : " {{ found_rpms.files[0].path }}" state : present disable_gpg_check : yes become : yes register : rpm_install_status # 4. Create the symlink using the EXTRACTED version (app_version) - name : " Create symlink to default version" ansible.builtin
Continue reading on Dev.to
Opens in a new tab



