-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprovision_user_env.yml
314 lines (285 loc) · 11.6 KB
/
provision_user_env.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
---
# vim: set ft=yaml.ansible :
- name: provision shell and environment
hosts: localhost
connection: local
vars:
win_temp: >-
{{ lookup('pipe', 'cmd.exe /c "echo" "%TEMP%"') }}
win_appdata: '{{ ansible_env.APPDATA }}'
win_programs: '{{ win_appdata }}\Microsoft\Windows\Start Menu\Programs'
win_startup: '{{ win_programs }}\Startup'
win_handyapps_startmenu: '{{ win_programs }}\Local Apps'
win_userprofile: >-
{{ lookup('pipe', 'cmd.exe /c "echo" "%USERPROFILE%"') }}
win_handyapps_root: '{{ win_userprofile }}\opt'
proxy_env:
http_proxy: '{{ ansible_env.http_proxy|default("") }}'
https_proxy: '{{ ansible_env.https_proxy|default("") }}'
fishers:
- oh-my-fish/theme-agnoster
handy_apps:
- src: https://github.com/nathancorvussolis/crvskkserv/releases/download/2.2.0/crvskkserv-2.2.0.zip
name: crvskkserv
startup: yes
-
# src: https://portableapps.com/redirect/?a=PortableApps.comPlatform&s=s&d=pa&f=PortableApps.com_Platform_Setup_16.0.paf.exe
src: https://portableapps.com/redirect/?a=PortableApps.comPlatform&s=s&d=pa&n=The%20PortableApps.com%20Platform&f=PortableApps.com_Platform_Setup_16.0.paf.exe
name: portableAppsPlatform
executable: Start.exe
startup: yes
- src: https://ja.osdn.net/frs/redir.php?m=jaist&f=yamy%2F43637%2Fyamy-0.03.zip
name: yamy
startup: yes
- src: https://download.sysinternals.com/files/ProcessExplorer.zip
name: ProcessExplorer
executable: procexp64.exe
- src: https://ftp.postgresql.org/pub/odbc/versions/dll/psqlodbc_10_03_0000-x64.zip
name: psqlodbc64
reg_startmenu: no
wsl_userprofile: >-
{{ lookup('pipe', 'wslpath "%s"' % win_userprofile) }}
wsl_handyapps_root: >-
{{ lookup('pipe', 'wslpath "%s"' % win_handyapps_root) }}
papp_root: '{{ wsl_handyapps_root }}/portableAppsPlatform/PortableApps/PortableApps.com'
papp_updater_dir: Updater
papp_updater: PortableAppsUpdater.exe
papp_font_dir: Data/Fonts
papp_ini: Data/PortableAppsMenu.ini
confhome: '{{ ansible_env.XDG_CONFIG_HOME|default("~/.config") }}'
confs_from_git:
- repo: https://github.com/mavnn/mintty-colors-solarized
dest: mintty/solarized
- repo: https://github.com/seebi/dircolors-solarized
dest: dircolors/solarized
config_fish: |-
source {{ confhome }}/mintty/solarized/sol.dark
eval (dircolors -c {{ confhome }}/dircolors/solarized/dircolors.256dark)
alias vi=nvim
alias vim=nvim
font_sources:
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Bold Oblique for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Bold for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Discord Bold Oblique for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Discord Bold for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Discord Oblique for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Discord Regular for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Oblique for Powerline.ttf
- https://github.com/mzyy94/RictyDiminished-for-Powerline/blob/master/powerline-fontpatched/Ricty Diminished Regular for Powerline.ttf
shortcut_ps: >
powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command '
$wsh = New-Object -ComObject WScript.Shell;
$link = $wsh.CreateShortcut("%(sc_linkname)s.lnk");
$link.Arguments = "%(sc_args)s";
$link.TargetPath = "%(sc_target)s";
$link.Save();'
skkdict_sources:
- https://github.com/skk-dev/dict/raw/master/SKK-JISYO.L
# - https://github.com/skk-users-jp/dic-mirror/raw/gh-pages/SKK-JISYO.L
# - http://openlab.jp/skk/dic/SKK-JISYO.L.gz
- http://d.hatena.ne.jp/images/keyword/keywordlist_furigana.csv
tasks:
- name: install fisher
shell: >
executable=/usr/bin/fish
creates={{ confhome }}/fish/functions/fisher.fish
curl https://git.io/fisher --create-dirs -sLo {{ confhome }}/fish/functions/fisher.fish
environment: '{{ proxy_env }}'
- name: install fish plugins
shell: >
executable=/usr/bin/fish
fisher ls| grep {{ item }}; or fisher add {{ item }}
environment: '{{ proxy_env }}'
register: _r
failed_when: _r.rc not in [0, 1]
changed_when: _r.rc == 1
loop: '{{ fishers }}'
- name: xdg config dirs created
file: >
path={{ confhome }}/{{ item.dest }}
state=directory
loop: '{{ confs_from_git }}'
- name: xdg cfg directory for copy config created
file: >
state=directory
path={{ confhome }}/{{ item.path }}
loop: '{{ lookup("filetree", "files/dot.config")|json_query("[?state==`directory`]") }}'
- name: xdg cfg files copied
copy: >
src={{ item.src }}
dest={{ confhome }}/{{ item.path }}
loop: '{{ lookup("filetree", "files/dot.config")|json_query("[?state==`file`]") }}'
- name: color schemes cloned
git: >
dest={{ confhome }}/{{ item.dest }}
repo={{ item.repo }}
environment: '{{ proxy_env }}'
loop: '{{ confs_from_git }}'
- name: prepare config.fish
copy: >
dest={{ confhome }}/fish/config.fish
content={{ config_fish }}
- name: local bin dir created
file: >
path=~/bin
state=directory
mode=0755
- name: user executable added to path
shell: >
executable=/usr/bin/fish
contains /home/{{ ansible_env.LOGNAME }}/bin $fish_user_paths; or set -U fish_user_paths ~/bin $fish_user_paths
register: _r
failed_when: _r.rc not in [0, 1]
changed_when: _r.rc == 1
- debug: var=_r verbosity=1
- name: handy apps folder created
shell: >
creates={{ lookup('pipe', 'wslpath "%s"' % win_handyapps_root) }}/{{ item.name }}
cmd.exe /c "mkdir" "{{ win_handyapps_root }}\{{ item.name }}"
loop: '{{ handy_apps }}'
- name: handy apps start menu folder created
shell: >
creates={{ lookup('pipe', 'wslpath "%s"' % win_handyapps_startmenu) }}
cmd.exe /c "mkdir" "{{ win_handyapps_startmenu }}"
- name: handy apps installed
unarchive: >
src={{ item.src }}
dest={{ wsl_handyapps_root }}/{{ item.name }}
remote_src=yes
environment: '{{ proxy_env }}'
when: item.src is search("(\.zip$|\.tar.gz)")
loop: '{{ handy_apps }}'
- name: handy_apps downloaded
get_url: >
url={{ item.src }}
dest={{ lookup('pipe', 'wslpath "%s"' % win_temp) }}
register: _get
environment: '{{ proxy_env }}'
when: item.src is not search("(\.zip$|\.tar.gz$)")
loop: '{{ handy_apps }}'
- name: handy_apps extracted
shell: >
creates={{ handy_app_dir }}/{{ item.item.executable|default(item.item.name ~ ".exe") }}
chdir={{ handy_app_dir }}
7z.exe x "{{ lookup('pipe', 'wslpath -w "%s"' % item.dest) }}" -y
vars:
handy_app_dir: >-
{{ lookup('pipe', 'wslpath "%s"' % win_handyapps_root) }}/{{ item.item.name }}
loop: '{{ _get|json_query("results[?dest!=`null`]") }}'
- name: shortcut added to start menu
shell: >
creates='{{ creates }}'
{{ shortcut_ps % shortcut_args }}
vars:
creates: >-
{{ lookup('pipe', 'wslpath "%s"' % win_handyapps_startmenu) }}/{{ item.name }}.lnk
shortcut_args:
sc_linkname: '{{ win_handyapps_startmenu }}\{{ item.name }}'
sc_args: '{{ item.args|default("") }}'
sc_target: '{{ win_handyapps_root }}\{{ item.name }}\{{ item.executable|default(item.name ~ ".exe") }}'
loop: '{{ handy_apps|json_query("[?reg_startmenu!=`false`]") }}'
- name: shortcut added to startup
shell: >
creates='{{ creates }}'
{{ shortcut_ps % shortcut_args }}
vars:
creates: >-
{{ lookup('pipe', 'wslpath "%s"' % win_startup) }}/{{ item.name }}.lnk
shortcut_args:
sc_linkname: '{{ win_startup }}\\{{ item.name }}'
sc_args: '{{ item.args|default("") }}'
sc_target: '{{ win_handyapps_root }}\\{{ item.name }}\\{{ item.executable|default(item.name ~ ".exe") }}'
loop: '{{ handy_apps|json_query("[?startup]") }}'
- name: papp addtional dir created
shell: >
creates={{ dest }}
cmd.exe /c "mkdir" "{{ lookup('pipe', 'wslpath -w ""%s""' % dest) }}"
register: _r
vars:
dest: '{{ papp_root }}/{{ item }}'
loop:
- '{{ papp_font_dir }}'
- '{{ papp_updater_dir }}'
- debug: var=_r verbosity=1
- name: download fonts
get_url: >
dest={{ dest }}/{{ item|urlsplit('path')|basename }}
url={{ item|replace(" ", "%20") }}?raw=true
loop: '{{ font_sources }}'
register: _font
environment: '{{ proxy_env }}'
vars:
dest: '{{ papp_root }}/{{ papp_font_dir }}'
until: _font is succeeded
- debug: var=_font verbosity=1
- name: portableApps ini updated for taskbar icon hiding
ini_file: >
section=DisplayOptions
path={{ papp_root }}/Data/PortableAppsMenu.ini
option=Windows7TaskbarIcon
no_extra_spaces=yes
value='false'
- name: portableApps updater moved
shell: >
creates={{ papp_root }}/{{ papp_updater_dir }}/{{ papp_updater }}
chdir={{ papp_root }}
mv {{ papp_updater }} {{ papp_updater_dir }}
- name: skk dict dir created
shell: >
creates={{ wsl_userprofile }}/SKKDICT
cmd.exe /c "mkdir {{ win_userprofile }}\SKKDICT"
register: _r
- debug: var=_r verbosity=1
- name: download dicts
get_url: >
dest={{ wsl_userprofile }}/SKKDICT/{{ item|urlsplit('path')|basename }}
url={{ item|replace(" ", "%20") }}
loop: '{{ skkdict_sources }}'
register: _skkdict
environment: '{{ proxy_env }}'
until: _skkdict is succeeded
- debug: var=_skkdict verbosity=1
- name: ruby script for hatena skk placed
copy: >
dest={{ wsl_userprofile }}/SKKDICT
src=hatena_skk.rb
force=no
mode=0755
register: _copy
- debug: var=_copy verbosity=1
- name: skk utf8 dict created (.gz)
shell: >
zcat {{ item }} | nkf -w -Lu > {{ item|regex_replace("\.gz$", "") }}.utf8
loop: '{{ _skkdict|json_query("results[?changed].dest") }}'
when:
- item is search("SKK-JISYO")
- item is search("\.gz$")
- name: skk utf8 dict created (flat)
shell: >
cat {{ item }} | nkf -w -Lu > {{ item }}.utf8
loop: '{{ _skkdict|json_query("results[?changed].dest") }}'
when:
- item is search("SKK-JISYO")
- item is not search("\.gz$")
- name: skk utf8 hatena dict created
shell: >
chdir={{ wsl_userprofile }}/SKKDICT
ruby.exe -Ke {{ _copy.dest|basename }} {{ item|basename }} | nkf -w -Lu > SKK-JISYO.hatena.utf8
loop: '{{ _skkdict|json_query("results[?changed].dest") }}'
when:
- item is search("\.csv$")
- name: skk dicts merged and sorted
shell: >
chdir={{ wsl_userprofile }}/SKKDICT
skkdic-expr2 -o SKK-JISYO.utf8.union {{ lookup('pipe', 'echo *.utf8').split()|join(" + ") }}
when: _skkdict is changed
- name: skk config template copied
copy: >
dest={{ wsl_userprofile }}/AppData/Roaming/CorvusSKK
src={{ item }}
loop: '{{ lookup("fileglob", "files/corvusskk_config_*.xml", wantlist=True) }}'
- name: yamy config added
copy: >
src={{ item }}
dest={{ wsl_userprofile }}/opt/yamy/{{ item|basename|regex_replace("^dot", "") }}
loop: '{{ lookup("fileglob", "files/*.mayu", wantlist=True) }}'