-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
111 lines (111 loc) · 3.67 KB
/
main.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
99
100
101
102
103
104
105
106
107
108
109
110
111
- name: Dev environment installer
hosts: localhost
connection: local
gather_facts: no
tasks:
- ansible.builtin.setup: {}
- name: Create directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ ansible_env.HOME }}/personal"
- "{{ ansible_env.HOME }}/work"
- "{{ ansible_env.HOME }}/repos"
- "{{ ansible_env.HOME }}/.config"
- "{{ ansible_env.HOME }}/.config/tms"
- "{{ playbook_dir }}/scripts"
- name: OS specific packages
include_tasks: "{{ ansible_os_family }}.yml"
- name: Set shell to zsh
become: true
user:
name: "{{ ansible_user_id }}"
shell: "/bin/zsh"
- name: Clone repos
ansible.builtin.git: "{{ item }}"
with_items:
- repo: https://github.com/neovim/neovim
dest: neovim
depth: 1
- repo: [email protected]:andresperezl/kickstart.nvim
dest: "{{ ansible_env.HOME }}/.config/nvim"
depth: 1
- repo: https://github.com/tmux-plugins/tpm
dest: "{{ ansible_env.HOME }}/.tmux/plugins/tpm"
depth: 1
- name: Build Neovim
community.general.make:
chdir: neovim
params:
CMAKE_BUILD_TYPE: RelWithDebInfo
- name: Install Neovim
become: true
community.general.make:
chdir: neovim
target: install
- name: Get tms install script
ansible.builtin.get_url:
url: https://github.com/jrmoulton/tmux-sessionizer/releases/download/v0.4.2/tmux-sessionizer-installer.sh
dest: scripts
mode: "0755"
- name: Install tms
shell: "scripts/tmux-sessionizer-installer.sh"
- name: Symlink configs
ansible.builtin.file:
state: link
src: "{{ item.src }}"
dest: "{{ item.dest }}"
force: yes
with_items:
- src: "{{ playbook_dir }}/configs/tmux.conf"
dest: "{{ ansible_env.HOME }}/.tmux.conf"
- src: "{{ playbook_dir }}/configs/tms_config.toml"
dest: "{{ ansible_env.HOME }}/.config/tms/config.toml"
- name: Get oh-my-zsh
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
dest: "scripts/install-omz.sh"
mode: "0755"
- name: Install oh-my-zsh
shell:
cmd: "scripts/install-omz.sh"
creates: "{{ ansible_env.HOME }}/.oh-my-zsh"
environment:
ZSH: ""
- name: Set up .zshrc
lineinfile:
path: "{{ ansible_env.HOME }}/.zshrc"
state: present
line: "{{ item }}"
with_items:
- unalias g
- alias vi=nvim
- alias vim=nvim
- alias cat=bat
- EDITOR=nvim; export EDITOR
- source $HOME/.cargo/env
- export NVM_DIR="$HOME/.nvm"
- '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' # This loads nvm
- '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' # This loads nvm bash_completion
- export GPG_TTY=$TTY
- name: Get g install script
ansible.builtin.get_url:
url: https://git.io/g-install
dest: scripts/g-install.sh
mode: "0755"
- name: Install g
shell: scripts/g-install.sh zsh -y
- name: Get oh-my-zsh
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh
dest: "scripts/install-nvm.sh"
mode: "0755"
- name: Install nvm
shell:
cmd: "scripts/install-nvm.sh"
creates: "{{ ansible_env.HOME }}/.nvm"
- name: Install node/npm
shell: . $NVM_DIR/nvm.sh && nvm install --lts
environment:
NVM_DIR: "{{ ansible_env.HOME }}/.nvm"