-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprovision.yml
124 lines (112 loc) · 3.39 KB
/
provision.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
---
# vim: set ft=yaml.ansible :
- name: provision wsl environment
hosts: localhost
connection: local
vars:
use_proxy: no
proxy_env: {}
__proxy_env:
http_proxy: http://150.67.140.80:3128
https_proxy: http://150.67.140.80:3128
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE: DontWarn
win_drives: |-
{% set ps = 'powershell.exe -c "(GET-WMIOBJECT -query \\"SELECT * from win32_logicaldisk where DriveType =''3''\\").DeviceID"|tr "[:upper:]" "[:lower:]"|tr -d ":"' %}
{{ lookup('pipe', ps).splitlines() }}
wsl_appdata: '{{ lookup("pipe", "wslpath \"%s\"" % ansible_env.APPDATA) }}'
wsl_user: '{{ ansible_env.LOGNAME }}'
ppas:
- ppa:fish-shell/release-3
- ppa:neovim-ppa/unstable
wsltty_items:
- url: 'https://raw.githubusercontent.com/mavnn/mintty-colors-solarized/master/.minttyrc.dark'
dest: '{{ wsl_appdata }}/wsltty/themes/solarized_dark'
- url: 'https://maoudamashii.jokersounds.com/music/se/wav/se_maoudamashii_system41.wav'
dest: '{{ wsl_appdata }}/wsltty/sounds/beep.wav'
wsl_conf: |-
[automount]
enabled = false
mountFsTab = true
timezone: |
Asia/Tokyo
tasks:
- name: superuser tasks
block:
- name: aptitude added
package: >
name={{ item }}
loop:
- aptitude
- dirmngr
- name: requirements for apt_repository
pip: >
name=python-apt
executable={{ item }}
state=latest
loop:
- pip3
- pip2
- name: repositories added #workaround wsl ubuntu1804
shell: >
creates=/etc/apt/sources.list.d/{{ item.split("/")[0][4:] }}*
apt-add-repository {{ item }} -y
loop: '{{ ppas }}'
register: _s
- debug: var=_s
- name: packages installed
apt: >
name={{ item }}
update_cache=yes
loop:
- language-pack-ja
- rsync
- fish
- neovim
- p7zip-full
- unzip
- nkf
- skktools
- name: python neovim packages installed
pip: >
name={{ item.0 }}
executable={{ item.1 }}
loop: '{{ pkgs|product(pips)|list }}'
vars:
pips:
- pip3
- pip2
pkgs:
- neovim
- jmespath
- name: default locale set to ja
command: update-locale LANG=ja_JP.UTF8
when: ansible_env.LANG|default("") != "ja_JP.UTF8"
- name: timezone file configured
copy: >
dest=/etc/timezone
content={{ timezone }}
register: _timezone
- name: timezone configured
command: dpkg-reconfigure --frontend noninteractive tzdata
when: _timezone is changed
- name: all win drives in fstab update to support metadata
mount: >
path=/mnt/{{ item }}
src='{{ item }}:'
fstype=drvfs
opts='metadata,umask=22,fmask=11,uid=1000,gid=1000'
state=present
register: _mount
loop: '{{ win_drives }}'
- debug: var=_mount verbosity=1
become: yes
environment: '{{ proxy_env }}'
- name: archiving current home if not mounted
shell: |
mountpoint /home/{{ wsl_user }} ||
tar cfz /tmp/{{ wsl_user }}.tar.gz -C /home/{{ wsl_user }} .
register: _mountpoint
changed_when: _mountpoint.stderr.find("is not") > -1
failed_when: _mountpoint.rc not in [0, 1]
- name: promt "Restart Console"
debug: msg="Exit all wsl console, Login again and Execute provision_user.yml"