Use ternary for git role

This commit is contained in:
flyingscorpio@clevo 2022-03-01 08:26:04 +01:00
parent 306787a60a
commit ee62cd8591

View file

@ -32,15 +32,12 @@
name: user.email
register: git_useremail
# TODO: check this
- name: Set vars for global gitconfig
vars:
username_if_absent: "{{ ansible_facts['env']['USER'] }}@{{ ansible_hostname }}"
set_fact:
username: "{{ (git_username.config_value != "") | ternary(git_username.config_value, ansible_facts['env']['USER']\@ansible_hostname) }}"
useremail: "{{ (git_useremail.config_value != "") | ternary(git_useremail.config_value, git_email) }}"
username: "{{ (git_username.config_value != '') | ternary(git_username.config_value, username_if_absent) }}"
useremail: "{{ (git_useremail.config_value != '') | ternary(git_useremail.config_value, git_email) }}"
- name: Copy global gitconfig
template: