Uncomment things from update-hosts.yml
[public/csc-playbooks.git] / install-etckeeper.yml
1 ---
2    - hosts: all
3      remote_user: root
4      tasks:
5         - name: update apt cache
6           apt: update_cache=yes
7         - name: install git
8           apt: name=git state=present
9         - name: install etckeeper
10           apt:  name=etckeeper state=present
11           register: etckeeper
12         - name:  update etckeeper VCS
13           lineinfile: dest=/etc/etckeeper/etckeeper.conf
14                       state=present
15                       backrefs=yes
16                       regexp={{ item.regex }}
17                       line={{ item.line }}
18           with_items:
19              - { regex: '^(VCS=.*)$', line: '#\\1' }
20              - { regex: '^#(VCS=\"git\")$', line: '\\1' }
21           when: etckeeper.changed == true
22         - name: re-initialize etckeeper with git
23           command: "{{ item }}"
24           with_items:
25              - 'etckeeper uninit -f'
26              - 'etckeeper init'
27              - 'git commit -m "Initial commit"'
28           args:
29              chdir: /etc
30           when: etckeeper.changed == true