forked from evolix/ansible-roles
etc-git: better commit author composition
This commit is contained in:
parent
accce99e05
commit
3207d837cb
|
@ -24,12 +24,13 @@
|
||||||
register: git_config_user_email
|
register: git_config_user_email
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: set commit author
|
- name: "set commit author"
|
||||||
set_fact:
|
set_fact:
|
||||||
etc_git_commit_options: "{ --author \"{{ ansible_env.SUDO_USER |default(\"root\")}} <{{ git_config_user_email.config_value |default(\"root@localhost\")}}>\""
|
commit_author: '{% if ansible_env.SUDO_USER == "" %}root{% else %}{{ ansible_env.SUDO_USER }}{% endif %}'
|
||||||
|
commit_email: '{% if git_config_user_email.config_value == "" %}root@localhost{% else %}{{ git_config_user_email.config_value }}{% endif %}'
|
||||||
|
|
||||||
- name: /etc modifications are committed
|
- name: "/etc modifications are committed"
|
||||||
shell: "git add -A . && git commit -m \"{{ commit_message | mandatory }}\"{{ etc_git_commit_options }}"
|
shell: "git add -A . && git commit -m \"{{ commit_message | mandatory }}\" --author \"{{ commit_author | mandatory }} <{{ commit_email | mandatory }}>\""
|
||||||
args:
|
args:
|
||||||
chdir: /etc
|
chdir: /etc
|
||||||
register: etc_commit_end_run
|
register: etc_commit_end_run
|
||||||
|
|
Loading…
Reference in a new issue