etc-git: do not erase custom entries of servers in .gitignore files

This commit is contained in:
Jérémy Dubois 2022-08-04 18:03:23 +02:00
parent 534efdcc01
commit 8e3b4b35cd
5 changed files with 17 additions and 5 deletions

View File

@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- evocheck: execute evocheck without --cron the first of the month
- etc-git: chmod 600 for local periodic files (daily, weekly, monthly)
- base: loop over fstab entries instead of copying the same task for each entries
- etc-git: do not erase custom entries of servers in .gitignore files
### Fixed

View File

@ -1,4 +0,0 @@
aliases.db
*.swp
random.seed
openvpn/ipp.txt

View File

@ -3,6 +3,11 @@
- include: repository.yml
vars:
repository_path: "/etc"
gitignore_items:
- "aliases.db"
- "*.swp"
- "random.seed"
- "openvpn/ipp.txt"
tags:
- etc-git
@ -16,6 +21,7 @@
- include: repository.yml
vars:
repository_path: "/usr/share/scripts"
gitignore_items: []
when:
- _usr_share_scripts.stat.exists
- _usr_share_scripts.stat.isdir

View File

@ -30,10 +30,19 @@
- name: "{{ repository_path }}/.gitignore is present"
copy:
src: "gitignore{{ repository_path | replace('/','_') }}"
src: gitignore
dest: "{{ repository_path }}/.gitignore"
owner: root
mode: "0600"
force: no
tags:
- etc-git
- name: "Some entries MUST be in the {{ repository_path }}/.gitignore file"
lineinfile:
dest: "{{ repository_path }}/.gitignore"
line: "{{ item }}"
loop: "{{ gitignore_items | default([]) }}"
tags:
- etc-git