etc-git: purge old .git/index.lock (default: True)

This commit is contained in:
Jérémy Lecour 2021-09-23 14:45:19 +02:00 committed by Jérémy Lecour
parent 3fcb79a3a3
commit 73efee9caa
4 changed files with 18 additions and 1 deletions

View File

@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
* Preliminary support for Debian 11 « Bullseye »
* apache: new variable for mpm mode (+ updated default config accordingly)
* certbot: add script for manual deploy hooks execution
* etc-git: purge old .git/index.lock (default: True)
* evolinux-base: install molly-guard by default
* generate-ldif: detect hardware raid card
* generate-ldif: detect mdadm

View File

@ -2,3 +2,5 @@
commit_message: Ansible run
etc_git_monitor_status: True
etc_git_purge_index_lock_enabled: True
etc_git_purge_index_lock_age: 86400

View File

@ -5,6 +5,20 @@
name: remount-usr
when: git_folder is match('/usr/.*')
- name: "stat {{ git_folder }}/.git/index.lock"
stat:
path: "{{ git_folder }}/.git/index.lock"
register: _index_lock
- name: index file is removed if old enough
file:
path: "{{ git_folder }}/.git/index.lock"
state: absent
when:
- _index_lock.stat.exists
- _index_lock.stat.mtime | int <= ((ansible_date_time.epoch | int) - etc_git_purge_index_lock_age | default(86400))
- etc_git_purge_index_lock_enabled
- name: "is {{ git_folder }} clean?"
command: git status --porcelain
args:

View File

@ -70,4 +70,4 @@
register: git_commit
when: git_log.rc != 0 or (git_init is defined and git_init is changed)
tags:
- etc-git
- etc-git