From ad6c5ae003bafc08e4b54d0729f041c968f53733 Mon Sep 17 00:00:00 2001 From: freezed <git-expect-noreply@freezed.me> Date: Thu, 5 Jan 2023 23:34:53 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Improve=20git=20task?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory.sample | 2 ++ tasks/user_cfg/my_user.yml | 7 +++++++ .../{files/dotfiles/gitconfig => templates/gitconfig.j2} | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) rename tasks/user_cfg/{files/dotfiles/gitconfig => templates/gitconfig.j2} (95%) diff --git a/inventory.sample b/inventory.sample index 6617b7e..4af320b 100644 --- a/inventory.sample +++ b/inventory.sample @@ -79,4 +79,6 @@ timezone="Europe/Paris" user_shell=/bin/zsh [workstation:vars] +git_email=<GIT_EMAIL> +git_name=<GIT_NAME> timezone="Europe/Paris" diff --git a/tasks/user_cfg/my_user.yml b/tasks/user_cfg/my_user.yml index 426b474..804c200 100644 --- a/tasks/user_cfg/my_user.yml +++ b/tasks/user_cfg/my_user.yml @@ -20,6 +20,13 @@ loop_control: label: "{{ item | basename }}" +- name: MY USER | git config + become: true + ansible.builtin.template: + dest: "/home/{{ my_user }}/.gitconfig" + src: templates/gitconfig.j2 + mode: 0640 + - name: MY USER | ssh config become: true ansible.builtin.template: diff --git a/tasks/user_cfg/files/dotfiles/gitconfig b/tasks/user_cfg/templates/gitconfig.j2 similarity index 95% rename from tasks/user_cfg/files/dotfiles/gitconfig rename to tasks/user_cfg/templates/gitconfig.j2 index cae03f7..e771e7e 100644 --- a/tasks/user_cfg/files/dotfiles/gitconfig +++ b/tasks/user_cfg/templates/gitconfig.j2 @@ -49,5 +49,5 @@ defaultBranch = stable [user] - name = freezed - email = git-expect-noreply@freezed.me + name = "{{ git_name }}" + email = "{{ git_email }}" -- GitLab