- name: Git
  hosts: all
  connection: local
  tasks:
    - name: Configure user name
      become: true
      become_user: '{{ item.key }}'
      ansible.builtin.command:
        argv:
          - git
          - config
          - --global
          - user.name
          - '{{ item.value.git.user_name }}'
      when: development and item.value.git
      loop: '{{ users | dict2items }}'
    - name: Configure user email
      become: true
      become_user: '{{ item.key }}'
      ansible.builtin.command:
        argv:
          - git
          - config
          - --global
          - user.email
          - '{{ item.value.git.user_email }}'
      when: development and item.value.git
      loop: '{{ users | dict2items }}'
    - name: Configure default branch
      become: true
      become_user: '{{ item.key }}'
      ansible.builtin.command:
        argv:
          - git
          - config
          - --global
          - init.defaultBranch
          - main
      when: development and item.value.git
      loop: '{{ users | dict2items }}'
