DEV Community

Query Filter
Query Filter

Posted on

docker-50

- name: "GET RPM PACKAGE INFO"
  ansible.builtin.shell: "rpm -qp --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}' {{ found_rpms.files[0].path }}"
  register: rpm_pkg_info
  changed_when: false

- name: "FORCE FRESH INSTALL FOR BUILD {{ lightspeed_acquired.build_number }}"
  block:
    - name: "REMOVE PRIOR VERSIONS"
      ansible.builtin.shell: "sudo -n /usr/bin/yum remove -y {{ rpm_pkg_info.stdout }}*"
      become: no
      ignore_errors: yes

    - name: "INSTALL NEW VERSION"
      vars:
        pkg_manager: "/usr/bin/yum"
      ansible.builtin.shell: "sudo -n {{ pkg_manager }} install -y {{ found_rpms.files[0].path }} --allowmissing --nogpgcheck"
      args:
        warn: false
      become: no
      register: rpm_install_status

- name: "PREPARE FINAL DIRECTORY"
  block:
    - name: "SET TARGET PATHS"
      ansible.builtin.set_fact:
        final_app_dir: "/opt/{{ app_prefix }}/{{ app_version }}-{{ lightspeed_acquired.build_number }}"
        current_app_dir: "/opt/{{ app_prefix }}/{{ app_version }}"

    - name: "RENAME TO BUILD VERSION"
      ansible.builtin.command: "mv {{ current_app_dir }} {{ final_app_dir }}"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)