aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/etckeeper/tasks/ignore.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-09-11 18:01:37 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-09-12 10:17:24 +0200
commit3b7ba8532f31d221c0708e2d6733bccdd3935f91 (patch)
tree9ba4be99b8a6589d30f94a9fa029cd8ec56d23ef /roles/etckeeper/tasks/ignore.yml
parentfix some ansible-lint warnings (diff)
downloadinfra-ansible-3b7ba8532f31d221c0708e2d6733bccdd3935f91.tar.gz
infra-ansible-3b7ba8532f31d221c0708e2d6733bccdd3935f91.zip
etckeeper: manage the ignore list
Diffstat (limited to 'roles/etckeeper/tasks/ignore.yml')
-rw-r--r--roles/etckeeper/tasks/ignore.yml18
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/etckeeper/tasks/ignore.yml b/roles/etckeeper/tasks/ignore.yml
new file mode 100644
index 0000000..a798368
--- /dev/null
+++ b/roles/etckeeper/tasks/ignore.yml
@@ -0,0 +1,18 @@
+- name: Add line to .gitignore
+ become: true
+ ansible.builtin.lineinfile:
+ path: /etc/.gitignore
+ line: '{{ ignore_path }}'
+ state: present
+ owner: root
+ group: root
+ mode: '644'
+ register: gitignore
+ notify: etckeeper_commit_gitignore
+
+- name: Remove path from cache
+ when: gitignore.changed
+ become: true
+ ansible.builtin.command: # noqa: command-instead-of-module
+ cmd: git rm -r --ignore-unmatch --cached -- '{{ ignore_path | regex_replace("^/", "") }}'
+ chdir: /etc