-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
98 lines (91 loc) · 3.21 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
- name: Install cli tools
hosts: all
tags:
- cli
vars:
tools_folder: /usr/local/opt/
tools:
- name: zellij
version: v0.41.2
github_repo: https://github.com/zellij-org/zellij
artifact_name: zellij-x86_64-unknown-linux-musl.tar.gz
- name: nvim
# archive include folder nvim-linux64
version: v0.10.2
github_repo: https://github.com/neovim/neovim
artifact_name: nvim-linux64.tar.gz
bin_path: nvim/nvim-linux64/bin/nvim
- name: lazygit
version: v0.44.1
github_repo: https://github.com/jesseduffield/lazygit
artifact_name: lazygit_0.44.1_Linux_x86_64.tar.gz
- name: starship
version: v1.21.1
github_repo: https://github.com/starship/starship
artifact_name: starship-x86_64-unknown-linux-gnu.tar.gz
- name: neovide
version: 0.13.3
github_repo: https://github.com/neovide/neovide
artifact_name: neovide-linux-x86_64.tar.gz
- name: eza
version: v0.20.10
github_repo: https://github.com/eza-community/eza
artifact_name: eza_x86_64-unknown-linux-gnu.tar.gz
tasks:
- name: Create bin folder
ansible.builtin.file:
path: "{{ item }}"
state: directory
become: true
loop: "{{ [tools_folder] | product(tools | map(attribute='name')) | map('join', '') }}"
- name: Extract tool
ansible.builtin.unarchive:
src: "{{ item.github_repo }}/releases/download/{{ item.version }}/{{ item.artifact_name }}"
dest: "{{ tools_folder ~ item.name }}"
remote_src: yes
become: true
loop: "{{ tools }}"
loop_control:
label: "{{ item.name }} ({{ item.version }})"
- name: Create a symbolic link
ansible.builtin.file:
src: "{{ tools_folder ~ ( item.bin_path | default(item.name ~ '/' ~ item.name)) }}"
dest: "/usr/local/bin/{{ item.name }}"
state: link
become: true
loop: "{{ tools }}"
loop_control:
label: "{{ tools_folder ~ ( item.bin_path | default(item.name ~ '/' ~ item.name)) }} to /usr/local/bin/{{ item.name }}"
- name: Install dotfiles
hosts: all
tags:
- config
vars:
stow_configs:
- alacritty
- fish
- nvim
- zellij
tasks:
- name: "Clone repository to {{ ansible_env.HOME }}"
ansible.builtin.git:
repo: "https://github.com/import-benjamin/.dotfiles.git"
dest: "{{ ansible_env.HOME }}/.dotfiles"
version: v1.1.0 # x-release-please-version
- name: "Fetch {{ ansible_env.HOME }}/.config directories"
ansible.builtin.stat:
path: "{{ ansible_env.HOME }}/.config/{{ item }}"
register: sym
loop: "{{ stow_configs }}"
loop_control:
label: "{{ ansible_env.HOME }}/.config/{{ item }}"
- name: "Update stow configuration"
ansible.builtin.command: "stow {{ '-R ' if config_dir.stat.islnk is defined and config_dir.stat.islnk }}{{ item }}"
args:
chdir: "{{ ansible_env.HOME }}/.dotfiles"
loop: "{{ stow_configs }}"
loop_control:
label: "stow {{ '-R ' if config_dir.stat.islnk is defined and config_dir.stat.islnk }}{{ item }}"
vars:
config_dir: "{{ sym.results | selectattr('item', 'equalto', item) | first }}"