Use ternary for git role
This commit is contained in:
parent
306787a60a
commit
ee62cd8591
1 changed files with 4 additions and 7 deletions
|
@ -32,15 +32,12 @@
|
||||||
name: user.email
|
name: user.email
|
||||||
register: git_useremail
|
register: git_useremail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: check this
|
|
||||||
- name: Set vars for global gitconfig
|
- name: Set vars for global gitconfig
|
||||||
|
vars:
|
||||||
|
username_if_absent: "{{ ansible_facts['env']['USER'] }}@{{ ansible_hostname }}"
|
||||||
set_fact:
|
set_fact:
|
||||||
username: "{{ (git_username.config_value != "") | ternary(git_username.config_value, ansible_facts['env']['USER']\@ansible_hostname) }}"
|
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) }}"
|
useremail: "{{ (git_useremail.config_value != '') | ternary(git_useremail.config_value, git_email) }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Copy global gitconfig
|
- name: Copy global gitconfig
|
||||||
template:
|
template:
|
||||||
|
|
Loading…
Add table
Reference in a new issue