tripleo-ansible/tripleo_ansible/roles/tripleo_transfer/tasks/flag.yml

43 lines
1.4 KiB
YAML

---
# Copyright 2019 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: check flag file existence in destination host
stat:
path: "{{ tripleo_transfer_flag_file }}"
register: tripleo_transfer_flag_stat
- name: fail if flag file exists
fail:
msg: >
Data transfer to '{{ tripleo_transfer_dest_dir }}' was prevented
by flag file existence. This means the transfer was attempted
before and another one would overwrite the data. If this is
desired, remove the flag file at '{{ tripleo_transfer_flag_file }}'
and re-run the data transfer.
when:
- tripleo_transfer_flag_stat.stat.exists
- name: ensure directory for flag file exists
file:
path: "{{ tripleo_transfer_flag_file|dirname }}"
state: directory
- name: create the flag file
file:
path: "{{ tripleo_transfer_flag_file }}"
state: touch