--- # Copyright Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - name: Replace soft link files with source files. gather_facts: false hosts: "{{ cifmw_target_hook_host | default('localhost') }}" vars: _base_dir: "{{ cifmw_architecture_repo }}" _link_files: "{{ cifmw_link2file_files | split(',') }}" tasks: - name: Gather the file details vars: _file_path: "{{ (_base_dir, item) | ansible.builtin.path_join }}" ansible.builtin.stat: path: "{{ _file_path }}" register: _file_info loop: "{{ _link_files }}" loop_control: label: "{{ item }}" - name: Remove all links when: - item.stat.islnk | default(false) ansible.builtin.file: path: "{{ item.stat.path }}" state: absent loop: "{{ _file_info.results }}" loop_control: label: "{{ item.item }}" - name: Replace link with actual file. when: - item.stat.islnk | default(false) vars: _file_path: "{{ (_base_dir, item.item) | ansible.builtin.path_join }}" ansible.builtin.copy: src: "{{ item.stat.lnk_source }}" dest: "{{ _file_path }}" mode: "0644" loop: "{{ _file_info.results }}" loop_control: label: "{{ item.item }}"