--- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 - name: Export log var file location shell: "export SSM_LOG_FILE=$VAR_FILE_LOCATION" environment: VAR_FILE_LOCATION: "{{ log_root_file_full_path }}" - name: Create .bashrc if they don't exist file: path: /root/.bashrc state: touch mode: '0644' owner: root group: root when: ansible_os_family == 'Suse' - name: Check if OS global vars have log file path lineinfile: name: /root/.bashrc regexp: '^SSM_LOG_FILE=/root/install/install.log' state: absent check_mode: yes changed_when: false register: line_is_present - name: Create log file global vars on OS - Redhat lineinfile: name: /root/.bashrc line: SSM_LOG_FILE=/root/install/install.log state: present insertafter: EOF when: (not line_is_present.found and ansible_os_family == 'RedHat') - name: Create log file global vars on OS - SUSE lineinfile: name: /root/.bashrc line: SSM_LOG_FILE=/root/install/install.log state: present insertafter: EOF when: (line_is_present.msg == 'file not present' and ansible_os_family == 'Suse')