Try ternary on git role

This commit is contained in:
flyingscorpio@clevo 2022-03-01 07:06:31 +01:00
parent 2364480b49
commit 306787a60a

View file

@ -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: