aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/etckeeper/tasks/ignore.yml
blob: f5446c0b87bb6d2f68a81f3a1129bd4a6c739c6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- name: Check git status
  # noqa: command-instead-of-module
  become: true
  ansible.builtin.command:
    cmd: git status --porcelain
    chdir: /etc
  changed_when: false
  register: etckeeper_git_status

- name: Fail if there're modifications
  when: |
    etckeeper_git_status.stdout_lines | length > 0
  ansible.builtin.fail:
    msg: |
      Unexpected modifications found:
      {{ etckeeper_git_status.stdout }}

- name: Configure ignored path
  loop: '{{ etckeeper_ignored_paths }}'
  loop_control:
    loop_var: ignore_path
  ansible.builtin.include_tasks: ignore_line.yml

- name: Commit .gitignore if necessary
  ansible.builtin.meta: flush_handlers