--- # Viya 3.3 compare rpm state before update ############################################################################### # Script name: gel.compareupdate.before.yml # # # # Description: Script to record the state of SAS rpms prior to an upgrade # # # # Creates status files in /tmp/updates/before/ # # # # Usage: # # # # Fom the same directory as the Viya install playbook # # # # ansible-playbook gel.compareupdate.before.yml # # # # # # Author: Gerry Nelson,Gilles Chrzaszcz, Erwan Granger GEL # # Date: 2018-02-15 # # Version: 1.00 # # # #-----------------------------------------------------------------------------# # CHANGELOG: # # 2018-02-15: Gerry Nelson,Gilles Chrzaszcz, Erwan Granger GEL # # init # # # #-----------------------------------------------------------------------------# # DISCLAIMER: # # This Ansible Playbook is provided as-is, without warranty of any kind, of # # any kind, either express or implied, including, but not limited to, the # # implied warranties of merchantability, fitness for a particular purpose, or # # non-infringement. # # SAS Institute shall not be liable whatsoever for any damages arising out of # # the use of this documentation and code, including any direct, indirect, or # # consequential damages. SAS Institute reserves the right to alter or abandon # # use of this documentation and code at any time. # # In addition, SAS Institute will provide no support for the materials # # contained herein. # # # ############################################################################### - hosts: sas-all become: true become_user: root tasks: - shell: hostname register: fromhost tags: - always - local_action: shell date +%Y-%m-%d-%H_%M register: ctimestamp tags: - always #- shell: rpm -qa | sort | grep sas- > {{ '/tmp/' + inventory_hostname + '_rpm_' + whenrun + '_update.txt'}} #- shell: yum list installed | sort | grep sas- > {{ '/tmp/' + inventory_hostname + '_yum_' + whenrun + '_update.txt'}} - name: list installed sas rpms and their repository shell: rpm -qa | sort | grep sas- > {{ '/tmp/' + fromhost.stdout + '_rpm_before_update.txt'}} - name: list installed sas rpms shell: yum list installed | sort | grep sas- > {{ '/tmp/' + fromhost.stdout + '_yum_before_update.txt'}} - name: find all files generated about update find: path: /tmp recurse: no pattern: "*_update.txt" register: files_to_copy - debug: msg: "{{files_to_copy}}" - name: get files from other hosts fetch: src: "{{ item.path }}" dest: "{{ '/tmp/updates/before/' + ctimestamp.stdout + '/' }}" flat: yes with_items: "{{ files_to_copy.files }}" - name: remove files from other hosts file: path: "{{ item.path }}" state: absent with_items: "{{ files_to_copy.files }}"