etckeeper.yml 1.34 KB
Newer Older
Julian Gethmann's avatar
Julian Gethmann committed
1 2 3
---
- name: install etckeeper
  become: yes
julian.gethmann's avatar
julian.gethmann committed
4 5 6
  package:
    name: etckeeper
    state: present
Julian Gethmann's avatar
Julian Gethmann committed
7 8 9

- name: Initialise etckeeper
  become: yes
julian.gethmann's avatar
julian.gethmann committed
10 11 12 13 14
  tags: etckeeper
  command: etckeeper init
  args:
    creates: "/etc/.etckeeper"
    chdir: /etc
Julian Gethmann's avatar
Julian Gethmann committed
15 16 17

- name: dnf as package manager
  become: yes
julian.gethmann's avatar
julian.gethmann committed
18 19 20 21 22
  lineinfile:
    dest: /etc/etckeeper/etckeeper.conf
    line: "HIGHLEVEL_PACKAGE_MANAGER=dnf"
    regexp: "HIGHLEVEL_PACKAGE_MANAGER=.*"
    backup: yes
julian.gethmann's avatar
julian.gethmann committed
23
  when: (ansible_distribution == "Fedora" and (ansible_distribution_major_version|int) >= 18)
24 25 26

- name: yum as package manager
  become: yes
julian.gethmann's avatar
julian.gethmann committed
27 28 29 30 31
  lineinfile:
    dest: /etc/etckeeper/etckeeper.conf
    line: "HIGHLEVEL_PACKAGE_MANAGER=yum"
    regexp: "HIGHLEVEL_PACKAGE_MANAGER=.*"
    backup: yes
julian.gethmann's avatar
julian.gethmann committed
32
  when: (ansible_distribution == "CentOS" and (ansible_distribution_major_version|int) <= 7)
33 34

- name: apt as package manager
julian.gethmann's avatar
julian.gethmann committed
35 36 37 38 39
  lineinfile:
    dest: /etc/etckeeper/etckeeper.conf
    line: "HIGHLEVEL_PACKAGE_MANAGER=apt"
    regexp: "HIGHLEVEL_PACKAGE_MANAGER=.*"
    backup: yes
40 41 42 43
  become: yes
  when: ansible_os_family == "Debian"

- name: use git
julian.gethmann's avatar
julian.gethmann committed
44 45 46 47 48
  lineinfile:
    dest: /etc/etckeeper/etckeeper.conf
    line: 'VCS="git"'
    regexp: '.*VCS="git"'
    backup: yes
49 50 51
  become: yes

- name: do not use bzr
julian.gethmann's avatar
julian.gethmann committed
52 53 54 55 56
  lineinfile:
    dest: /etc/etckeeper/etckeeper.conf
    line: '# VCS="bzr"'
    regexp: '.*VCS="bzr"'
    backup: yes
57 58
  become: yes