main.yml (1098B)
1 --- 2 - name: Check for an incomplete deployment 3 ansible.builtin.stat: 4 path: "{{ deployment_state_directory }}/incomplete" 5 register: deployment_state_previous 6 7 - name: Remember whether configuration handlers need to be recovered 8 ansible.builtin.set_fact: 9 deployment_recover_configuration: "{{ deployment_state_previous.stat.exists }}" 10 11 # This bookkeeping is created and removed on every successful deployment. 12 # It should not count as a configuration change or modify hosts in check mode. 13 - name: Create the private deployment state directory 14 ansible.builtin.file: 15 path: "{{ deployment_state_directory }}" 16 state: directory 17 owner: root 18 group: root 19 mode: "0700" 20 changed_when: false 21 when: not ansible_check_mode 22 23 - name: Record the incomplete deployment before modifying services 24 ansible.builtin.copy: 25 content: "Configuration may not have been applied by a completed deployment.\n" 26 dest: "{{ deployment_state_directory }}/incomplete" 27 force: false 28 owner: root 29 group: root 30 mode: "0600" 31 changed_when: false 32 when: not ansible_check_mode