From 306787a60acaf53f55d581668fbbed453c94eb6f Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Tue, 1 Mar 2022 07:06:31 +0100 Subject: [PATCH] Try ternary on git role --- roles/git/tasks/main.yml | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 90b20ae..a58c3c9 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -32,25 +32,15 @@ name: user.email register: git_useremail -- name: Reuse username - set_fact: - username: "{{ git_username.config_value }}" - when: git_username.config_value != "" -- name: Set new username - set_fact: - username: "{{ ansible_facts['env']['USER'] }}@{{ ansible_hostname }}" - when: git_username.config_value == "" -- name: Reuse useremail +# TODO: check this +- name: Set vars for global gitconfig set_fact: - useremail: "{{ git_useremail.config_value }}" - when: git_useremail.config_value != "" + 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) }}" + -- name: Set new useremail - set_fact: - useremail: "{{ git_email }}" # Set in vault - when: git_useremail.config_value == "" - name: Copy global gitconfig template: