From 4a05ea02ec5e8fc259fae0351c789bcb8a4c8cd9 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Thu, 17 Dec 2020 20:04:32 +0100 Subject: [PATCH] ansible: fix git role syntax for consistency --- roles/git/tasks/main.yml | 62 ++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/roles/git/tasks/main.yml b/roles/git/tasks/main.yml index 3c9952a..5948ac9 100644 --- a/roles/git/tasks/main.yml +++ b/roles/git/tasks/main.yml @@ -1,44 +1,58 @@ -- name: Install git (Debian) +- name: Install git with apt when: ansible_os_family == "Debian" become: yes - apt: name={{ item }} state=latest update_cache=yes - loop: [git, git-crypt, git-lfs] + apt: + update_cache: yes + state: latest + name: + - git + - git-crypt + - git-lfs -- name: Install git (macOS) + +- name: Install git with homebrew when: ansible_os_family == "Darwin" - homebrew: name={{ item }} state=latest - loop: [git, git-crypt, git-lfs] + homebrew: + state: latest + name: + - git + - git-crypt + - git-lfs + - name: Create the git config directories file: - path: "{{ item }}" - state: directory + path: "{{ item }}" + state: directory loop: - - ~/.config/git - - ~/.local/bin - - ~/.local/etc/git + - ~/.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 + src: "{{ role_path }}/files/{{ item }}" + dest: ~/.config/git/{{ item }} + state: link + force: yes loop: - - config - - ignore + - config + - ignore + - name: Deploy git host-specific config template: - src: config.host.j2 - dest: ~/.local/etc/git/config.host + 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 + src: "{{ item }}" + dest: "~/.local/bin/{{ item | basename }}" + state: link + force: yes with_fileglob: - - ./bin/* + - "{{ role_path }}/files/bin/*"