- name: Install git with apt when: ansible_os_family == "Debian" become: yes apt: update_cache: yes state: latest name: - git - git-crypt - git-lfs - name: Install git with homebrew when: ansible_os_family == "Darwin" homebrew: state: latest name: - git - git-crypt - git-lfs - name: Create the git config directories file: path: "{{ item }}" state: directory loop: - ~/.config/git - ~/.local/bin - ~/.local/etc/git - name: Deploy git config file: src: "{{ role_path }}/files/{{ item }}" dest: ~/.config/git/{{ item }} state: link force: yes loop: - config - ignore - name: Deploy git host-specific config template: src: config.host.j2 dest: ~/.local/etc/git/config.host - name: Deploy additional git commands file: src: "{{ item }}" dest: "~/.local/bin/{{ item | basename }}" state: link force: yes with_fileglob: - "{{ role_path }}/files/bin/*"