aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/etckeeper/handlers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--roles/etckeeper/handlers/commit.yml (renamed from roles/etckeeper/handlers/commit_conf.yml)4
-rw-r--r--roles/etckeeper/handlers/main.yml12
2 files changed, 13 insertions, 3 deletions
diff --git a/roles/etckeeper/handlers/commit_conf.yml b/roles/etckeeper/handlers/commit.yml
index 134e264..f48db8f 100644
--- a/roles/etckeeper/handlers/commit_conf.yml
+++ b/roles/etckeeper/handlers/commit.yml
@@ -4,7 +4,7 @@
set -o pipefail && \
git status --porcelain=v1 \
| cut -c 4- \
- | grep -G -v '^etckeeper/etckeeper.conf'
+ | grep -G -v '^{{ paths | map("regex_replace", "^/", "") | list | join("\|^") }}'
args:
chdir: /etc
register: git_status
@@ -21,4 +21,4 @@
- name: etckeeper commit
become: true
ansible.builtin.command: |
- etckeeper commit 'configure etckeeper'
+ etckeeper commit '{{ commit_msg }}'
diff --git a/roles/etckeeper/handlers/main.yml b/roles/etckeeper/handlers/main.yml
index 9993ed5..ca6beaa 100644
--- a/roles/etckeeper/handlers/main.yml
+++ b/roles/etckeeper/handlers/main.yml
@@ -1,3 +1,13 @@
- name: Commit etckeeper.conf
- ansible.builtin.include_tasks: commit_conf.yml
+ ansible.builtin.include_tasks: commit.yml
+ vars:
+ paths: [etckeeper/etckeeper.conf]
+ commit_msg: configure etckeeper
listen: etckeeper_commit_conf
+
+- name: Commit .gitignore
+ ansible.builtin.include_tasks: commit.yml
+ vars:
+ paths: '{{ [".gitignore"] + etckeeper_ignored_paths + etckeeper_extra_ignored_paths }}'
+ commit_msg: configure ignored files
+ listen: etckeeper_commit_gitignore