etc-git: create gitignore files differently so that it stays idempotent

This commit is contained in:
Jérémy Dubois 2022-04-13 17:53:09 +02:00
parent e1ae8fefb9
commit 490b733f1a
4 changed files with 7 additions and 16 deletions

View File

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

View File

@ -19,11 +19,6 @@
- include: repository.yml
vars:
repository_path: "/etc"
gitignore_items:
- "aliases.db"
- "*.swp"
- "random.seed"
- "openvpn/ipp.txt"
- name: verify /usr/share/scripts presence
stat:
@ -33,7 +28,6 @@
- include: repository.yml
vars:
repository_path: "/usr/share/scripts"
gitignore_items: []
when:
- _usr_share_scripts.stat.isdir

View File

@ -29,21 +29,14 @@
- etc-git
- name: "{{ repository_path }}/.gitignore is present"
file:
path: "{{ repository_path }}/.gitignore"
copy:
src: "gitignore{{ repository_path | replace('/','_') }}"
dest: "{{ repository_path }}/.gitignore"
owner: root
mode: "0600"
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
- name: Set vim as default editor
git_config:
name: core.editor