aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/roles/etckeeper/tasks/ignore.yml
blob: a798368973fd4ec0976dd49dd9026a0a08231937 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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