- name: "LOGIC: PREPARE FINAL DIRECTORY AND SYMLINK"
block:
# 1. Define the final path including the build number
- name: Set target path
ansible.builtin.set_fact:
final_app_dir: "/opt/CPLS/{{ app_version }}_{{ build_number }}"
current_app_dir: "/opt/CPLS/{{ app_version }}"
# 2. Rename the directory to include the build number
- name: Rename application folder to include build number
ansible.builtin.command: "mv {{ current_app_dir }} {{ final_app_dir }}"
args:
creates: "{{ final_app_dir }}"
when: current_app_dir != final_app_dir
# 3. Create or Update the Symlink
# force: yes makes this operation atomic. If 'live' already exists,
# it updates it to point to the new directory immediately.
- name: Create symbolic link
ansible.builtin.file:
src: "{{ final_app_dir }}"
dest: "/opt/CPLS/live"
state: link
force: yes
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)