CSC Ansible Playbooks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
csc-playbooks/install-etckeeper.yml

30 lines
1.0 KiB

---
- hosts: all
remote_user: root
tasks:
- name: update apt cache
apt: update_cache=yes
- name: install git
apt: name=git state=present
- name: install etckeeper
apt: name=etckeeper state=present
register: etckeeper
- name: update etckeeper VCS
lineinfile: dest=/etc/etckeeper/etckeeper.conf
state=present
backrefs=yes
regexp={{ item.regex }}
line={{ item.line }}
with_items:
- { regex: '^(VCS=.*)$', line: '#\\1' }
- { regex: '^#(VCS=\"git\")$', line: '\\1' }
when: etckeeper.changed == true
- name: re-initialize etckeeper with git
command: "{{ item }}"
with_items:
- 'etckeeper uninit -f'
- 'etckeeper init'
- 'git commit -m "Initial commit"'
args:
chdir: /etc
when: etckeeper.changed == true