set git user.{name,email}

master
neingeist 8 years ago
parent c505d66f60
commit 3d4ed5aa2a

@ -23,3 +23,13 @@ roles:
etckeeper_avoid_autocommits: true,
etckeeper_mailto: root }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The role sets "root <root@the.host.name>" as the default user/email in
etckeeper's git config. To change that set these options:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
roles:
- { role: etckeeper, tags: ['system', 'etckeeper'],
etckeeper_user_name: "Charlie Root",
etckeeper_user_email: "charlie@corp.com" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@ -1,2 +1,4 @@
---
etckeeper_avoid_autocommits: false
etckeeper_user_name: "root"
etckeeper_user_email: "root@{{ ansible_fqdn}}"

@ -30,6 +30,40 @@
- name: "etckeeper: Initialize"
command: etckeeper init creates=/etc/.git/
- name: "check git user.name"
command: git config user.name
args:
chdir: /etc
warn: off
register: name_configured
ignore_errors: True
changed_when: False
- name: "configure git user.name"
command: git config user.name "{{etckeeper_user_name}}"
args:
chdir: /etc
warn: off
when: name_configured.stdout != "{{etckeeper_user_name}}"
- name: "check git user.email"
command: git config user.email
args:
chdir: /etc
warn: off
register: email_configured
ignore_errors: True
changed_when: False
- name: "configure git user.email"
command: git config user.email "{{etckeeper_user_email}}"
args:
chdir: /etc
warn: off
when: email_configured.stdout != "{{etckeeper_user_email}}"
- name: enable etckeeper commit mails
template: src=post-commit-mail.j2
dest=/etc/.git/hooks/post-commit

Loading…
Cancel
Save