forked from patrick-motard/dot-ansible
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
166 lines (165 loc) · 6.04 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
- hosts: 127.0.0.1
connection: local
vars:
- local_user: "han"
- github_user: "patrick-motard"
- new_install: true
- background_images_dir: "{{ansible_user_dir}}/Dropbox/photos/backgrounds/2017/selected"
- dot_ansible_path: "{{ansible_user_dir}}/code/dot-ansible"
# - desktop_background_schedule: "*/1 * * * *"
# install packages from pacman_pkgs
- optional_pacman_packages: true
# install packages from aur_pkgs
- optional_aur_packages: true
roles:
- pacman
- zsh
- desktop-background
- lock-screen
- lastpass
tasks:
- name: Enable thumbnails for pictures and videos.
tags: thumbnails
import_tasks: thumbnails.yml
# - name: ckb (corsair keyboard)
# block:
# # ckb is the linux daemon for corsair keyboards
# - name: See if ckb is installed
# shell: "pacman -Qemq | grep -c ckb-next"
# register: ckb
# - name: ckb-next
# when: ckb.stdout == "1"
# systemd:
# name: ckb-next-daemon
# state: started
# enabled: yes
- name: Docker
become: true
block:
- name: Create docker usergroup
group:
name: docker
state: present
- name: Add user to docker group
# so that we don't have to type sudo every time we use docker
user:
name: "{{local_user}}"
groups: docker
append: yes
- name: Start/Enable docker service
systemd:
name: docker
state: started
enabled: yes
- name: Python packages
become: false
pip:
name:
- pip
- awscli
- polybar-reload
extra_args: --user
- name: Install Vundle
become: false
git:
repo: "https://github.com/VundleVim/Vundle.vim.git"
dest: "{{ansible_user_dir}}/.vim/bundle/Vundle.vim"
- name: See if yadm has a repo cloned.
stat:
path: "{{ansible_user_dir}}/.yadm/repo.git"
register: yadm_repo
- name: Clone dotfiles repo with yadm.
become: false
shell: "yadm clone https://github.com/{{github_user}}/dotfiles.git"
ignore_errors: yes
- name: Set yadm remote to .ssh
become: false
shell: "yadm remote set-url origin [email protected]:{{github_user}}/dotfiles.git"
when: yadm_repo.stat.exists == false
- name: Set dot-ansible remote to .ssh
become: false
shell: "git remote set-url origin [email protected]:patrick-motard/dot-ansible.git"
args:
chdir: "{{ansible_user_dir}}/code/dot-ansible"
- name: Link dotfiles to dot-ansible
# The idea of this block of tasks is to make sure the user has all the aliases,
# exports, functions, etc that they need. If a new feature is introduced by
# dot-ansible, but it requires a user to add a line of code/configuration to their
# .*rc file, that sucks. Instead, this will make sure that their .*rc file imports
# all the settings required. We add a source line to their .*rc file (.profile is
# the best option as it's always loaded, no matter if you use zsh or bash), that
# will source a file from dot-ansible (the file is currently called 'shell-imports').
# That file will include all the needed aliases, exports, etc.
# It's somewhat similar to the approach that oh-my-zsh follows with their plugins.
# That's the end goal at least.
become: false
block:
- stat:
path: "{{ansible_user_dir}}/.profile"
register: profile_stat_result
- debug: var=profile_stat_result
- file:
path: "{{ansible_user_dir}}/.profile"
state: touch
when: profile_stat_result.stat.exists == false
- blockinfile:
path: "{{ansible_user_dir}}/.profile"
block: |
source ~/code/dot-ansible/shell-imports.sh
marker: "# {mark} managed by dot-ansible in ~/code/dot-ansible"
# TODO: installing nodejs through nvm isn't necessary, it's# done automatically once
# you log in. The second task to install packages should be run only if node is installed.
# (will run on subsequent calls)
# - name: NodeJS
# become: false
# block:
# - name: install Node with NVM
# shell: |
# echo $USER
# . {{ansible_user_dir}}/.nvm/nvm.sh
# node_version=$(<{{ansible_user_dir}}/.nvmrc)
# nvm install $node_version
# - name: install npm packages
# npm:
# name: "{{item}}"
# global: yes
# with_items:
# - tern
- name: See if spacemacs is installed.
stat:
path: "{{ansible_user_dir}}/.emacs.d"
register: spacemacs_repo
- name: Remove ~/.emacs.d
become: false
file:
path: "{{ansible_user_dir}}/.emacs.d"
state: absent
when: spacemacs_repo.stat.exists == false
- name: Install Spacemacs
become: false
git:
repo: "https://github.com/syl20bnr/spacemacs"
dest: "{{ansible_user_dir}}/.emacs.d"
version: develop
#TODO: This needs gopath to be set correctly before it can be run
- name: Install go packages
become: false
shell: "go get -u -v {{item}}"
ignore_errors: true
with_items:
# needed for spacemacs go layer
# https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/go
- "github.com/nsf/gocode"
- "github.com/rogpeppe/godef"
- "golang.org/x/tools/cmd/guru"
- "golang.org/x/tools/cmd/gorename"
- "golang.org/x/tools/cmd/goimports"
# needed for guru -> import/add dependencies (spacemacs go layer)
- "github.com/uudashr/gopkgs/cmd/gopkgs"
# needed for dotfiles
- "github.com/itchyny/volume-go/cmd/volume"
- "github.com/patrick-motard/dot"
# - name: Update all existing golang packages
# become: false
# shell: go get -u all