Files
env-ansible/tasks/general/tests/lock_create.yml
T
2026-10-02 11:21:31 -07:00

23 lines
611 B
YAML

---
# 20260929 - Hyperling
# Ensure an existing run is not active, otherwise bail.
- name: General | Tests | Existing Run | Lock | Create
ansible.builtin.shell: "date +'%Y-%m-%d %H:%M:%S' >> {{lock_file }}"
- name: General | Tests | Existing Run | Lock | Create
file:
name: "{{ lock_file }}"
mode: '0777'
- name: General | Tests | Existing Run | Lock | Create | Check
ansible.builtin.stat:
path: "{{ lock_file }}"
register: lock_exists
- name: General | Tests | Existing Run | Lock | Create | Fail
fail:
msg: "ERROR: Lock file does not exist."
when: not lock_exists.stat.exists