From ee62cd859147e9d100e6df8587f6b140d307fb92 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Tue, 1 Mar 2022 08:26:04 +0100 Subject: [PATCH] Use ternary for git role --- roles/git/tasks/main.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index a58c3c9..b349ddf 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -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: