Skip to content

Commit

Permalink
Preserve access_time and modification_time on newly created directori…
Browse files Browse the repository at this point in the history
…es to allow the playbook to be idempotent.
  • Loading branch information
YPCrumble committed Apr 14, 2023
1 parent 2d3d0e3 commit 8bb9575
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
15 changes: 10 additions & 5 deletions roles/celery/tasks/setup_supervisor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
mode=0644

- name: Create the log directory for {{ celery_application_name }}
ansible.builtin.file: path={{ celery_log_dir }}
owner={{ celery_user }}
group={{ celery_group }}
state=directory
mode=0644
ansible.builtin.file:
path: "{{ celery_log_dir }}"
owner: "{{ celery_user }}"
group: "{{ celery_group }}"
state: directory
mode: "0644"
# Set to `preserve` to make sure the task is idempotent.
# See https://github.com/ansible/ansible/issues/30226#issuecomment-433643224
access_time: preserve
modification_time: preserve

- name: Check for an existing celery logfile
ansible.builtin.stat:
Expand Down
16 changes: 11 additions & 5 deletions roles/web/tasks/setup_virtualenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@
tags: deploy

- name: Create the application log folder
ansible.builtin.file: path={{ application_log_dir }}
owner={{ gunicorn_user }}
group={{ gunicorn_group }}
mode=0774
state=directory
ansible.builtin.file:
path: "{{ application_log_dir }}"
owner: "{{ gunicorn_user }}"
group: "{{ gunicorn_group }}"
mode: "0774"
state: directory
# Set to `preserve` to make sure the task is idempotent.
# See https://github.com/ansible/ansible/issues/30226#issuecomment-433643224
access_time: preserve
modification_time: preserve


- name: Check for an existing application logfile
ansible.builtin.stat:
Expand Down

0 comments on commit 8bb9575

Please sign in to comment.