Tools: docker25
Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse
$ ---
# 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.-weight: 500;">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.file: # Points to /opt/CPLS/1.0.0 instead of the migration ID src: "/opt/CPLS/{{ app_version }}" dest: "/opt/CPLS/live" state: link force: yes follow: false become: yes # 5. Verification messages
- name: "Verification: Announce directory check" ansible.builtin.debug: msg: "Checking contents of /opt/CPLS/live/ (Version: {{ app_version }})" - name: "Verification: List content of the symbolic link" ansible.builtin.command: cmd: "ls -ltr /opt/CPLS/live/" register: symlink_contents become: yes # noqa command-instead-of-module - name: "Verification: Display results" ansible.builtin.debug: var: symlink_contents.stdout_lines
---
# 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.-weight: 500;">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.file: # Points to /opt/CPLS/1.0.0 instead of the migration ID src: "/opt/CPLS/{{ app_version }}" dest: "/opt/CPLS/live" state: link force: yes follow: false become: yes # 5. Verification messages
- name: "Verification: Announce directory check" ansible.builtin.debug: msg: "Checking contents of /opt/CPLS/live/ (Version: {{ app_version }})" - name: "Verification: List content of the symbolic link" ansible.builtin.command: cmd: "ls -ltr /opt/CPLS/live/" register: symlink_contents become: yes # noqa command-instead-of-module - name: "Verification: Display results" ansible.builtin.debug: var: symlink_contents.stdout_lines
---
# 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.-weight: 500;">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.file: # Points to /opt/CPLS/1.0.0 instead of the migration ID src: "/opt/CPLS/{{ app_version }}" dest: "/opt/CPLS/live" state: link force: yes follow: false become: yes # 5. Verification messages
- name: "Verification: Announce directory check" ansible.builtin.debug: msg: "Checking contents of /opt/CPLS/live/ (Version: {{ app_version }})" - name: "Verification: List content of the symbolic link" ansible.builtin.command: cmd: "ls -ltr /opt/CPLS/live/" register: symlink_contents become: yes # noqa command-instead-of-module - name: "Verification: Display results" ansible.builtin.debug: var: symlink_contents.stdout_lines