forked from evolix/ansible-roles
etc-git: purge old .git/index.lock (default: True)
This commit is contained in:
parent
3fcb79a3a3
commit
73efee9caa
|
@ -15,6 +15,7 @@ The **patch** part changes incrementally at each release.
|
||||||
* Preliminary support for Debian 11 « Bullseye »
|
* Preliminary support for Debian 11 « Bullseye »
|
||||||
* apache: new variable for mpm mode (+ updated default config accordingly)
|
* apache: new variable for mpm mode (+ updated default config accordingly)
|
||||||
* certbot: add script for manual deploy hooks execution
|
* certbot: add script for manual deploy hooks execution
|
||||||
|
* etc-git: purge old .git/index.lock (default: True)
|
||||||
* evolinux-base: install molly-guard by default
|
* evolinux-base: install molly-guard by default
|
||||||
* generate-ldif: detect hardware raid card
|
* generate-ldif: detect hardware raid card
|
||||||
* generate-ldif: detect mdadm
|
* generate-ldif: detect mdadm
|
||||||
|
|
|
@ -2,3 +2,5 @@
|
||||||
commit_message: Ansible run
|
commit_message: Ansible run
|
||||||
|
|
||||||
etc_git_monitor_status: True
|
etc_git_monitor_status: True
|
||||||
|
etc_git_purge_index_lock_enabled: True
|
||||||
|
etc_git_purge_index_lock_age: 86400
|
||||||
|
|
|
@ -5,6 +5,20 @@
|
||||||
name: remount-usr
|
name: remount-usr
|
||||||
when: git_folder is match('/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?"
|
- name: "is {{ git_folder }} clean?"
|
||||||
command: git status --porcelain
|
command: git status --porcelain
|
||||||
args:
|
args:
|
||||||
|
|
|
@ -70,4 +70,4 @@
|
||||||
register: git_commit
|
register: git_commit
|
||||||
when: git_log.rc != 0 or (git_init is defined and git_init is changed)
|
when: git_log.rc != 0 or (git_init is defined and git_init is changed)
|
||||||
tags:
|
tags:
|
||||||
- etc-git
|
- etc-git
|
Loading…
Reference in a new issue