forked from wizawu/sysconf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.yml
executable file
·217 lines (199 loc) · 5.26 KB
/
install.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
- hosts: localhost
vars_prompt:
- name: agree
prompt: Cancel the play with CTRL+C or continue with ENTER
tasks:
- name: create group
group: name=docker
- name: create user
user:
name: "{{user}}"
groups:
- docker
- root
shell: /bin/bash
- name: create template config
template: src={{item}}.tpl dest=/{{item}} mode=0440
with_items:
- etc/security/limits.d/default.conf
- etc/sudoers.d/default
- name: change file mode of this repo
file:
dest: /home/{{user}}/.sysconf
state: directory
recurse: true
owner: "{{user}}"
- name: locale-gen
locale_gen: name={{item}} state=present
with_items:
- en_US.UTF-8
- zh_CN
- zh_CN.GB18030
- zh_CN.GBK
- zh_CN.UTF-8
- name: hold libc6
command: apt-mark hold libc6
- name: import apt keys
apt_key:
keyserver: keyserver.ubuntu.com
id: "{{item}}"
with_items:
- 7EA0A9C3F273FCD8 # docker
- E88979FB9B30ACF2 # chrome
- EB3E94ADBE1229CF # vscode
- name: install apt packages
apt:
update_cache: true
install_recommends: false
name:
- acpi
- alsa-oss
- alsa-tools
- alsa-utils
- apache2-utils
- bash-completion
- cifs-utils
- colortail
- debootstrap
- dnsutils
- dstat
- entr
- expect
- f2fs-tools
- fio
- fiu-utils
- fuse-overlayfs
- gcp
- glusterfs-client
- grub2-common
- haproxy
- hdparm
- hsetroot
- im-config
- lftp
- lm-sensors
- locate
- lshw
- lsof
- m4
- make
- manpages-dev
- nethogs
- network-manager
- nfs-common
- nginx
- nmap
- nodejs
- ntfs-3g
- p7zip-full
- parallel
- pppoeconf
- psmisc
- pulseaudio
- putty-tools
- rinetd
- rlwrap
- rsync
- sntp
- software-properties-common
- ssh
- sshfs
- sshpass
- strace
- supervisor
- syslog-ng
- sysstat
- systemd-sysv
- tlp
- tlp-rdw
- util-linux-extra
- wpasupplicant
- libfuse2
- name: check built-in tools
shell: command -v {{item}}
with_items:
- getconf
- ipcs
- losetup
- lscpu
- lsusb
- pmap
- trap
- name: create symbolic link to apt sources.list
file:
src: /home/{{user}}/.sysconf/etc/apt/sources.list.d/{{item}}
dest: /etc/apt/sources.list.d/{{item}}
state: link
force: true
with_items:
- default.list
- google-chrome.list
- vscode.list
- include_tasks: tasks/command.yml
- include_tasks: tasks/desktop.yml
- include_tasks: tasks/vscode.yml
- include_tasks: tasks/pip.yml
- include_tasks: tasks/npm.yml
- include_tasks: tasks/cleanup.yml
- name: create etc directories
file: dest=/{{item}} state=directory recurse=yes
with_items:
- etc/apt/apt.conf.d
- etc/opt/chrome/policies/managed
- etc/security/limits.d
- etc/supervisor/conf.d
- name: create symbolic link to global config
file: src=/home/{{user}}/.sysconf/{{item}} dest=/{{item}} state=link force=yes
with_items:
- etc/apt/apt.conf.d/99default
- etc/docker/daemon.json
- etc/opt/chrome/policies/managed/blocklist.json
- etc/rc.local
- name: disable NetworkManager dns
lineinfile:
dest: /etc/NetworkManager/NetworkManager.conf
regexp: '^dns\s{0,}='
line: "dns=none"
insertafter: "[main]"
ignore_errors: true
- name: restart NetworkManager
service:
name: NetworkManager
state: restarted
ignore_errors: true
- name: update systemd logind.conf
lineinfile:
dest: /etc/systemd/logind.conf
regexp: '^{{item.key}}\s{0,}='
line: "{{item.key}}={{item.value}}"
with_items:
- { key: "HandleLidSwitch", value: "ignore" }
- { key: "HandlePowerKey", value: "suspend" }
- name: configure kernel parameters
sysctl:
name: "{{item.name}}"
value: "{{item.value}}"
with_items:
- name: fs.inotify.max_user_watches
value: 524288
- name: kernel.pid_max
value: 999999
# async-profiler
- name: kernel.kptr_restrict
value: 0
- name: kernel.perf_event_paranoid
value: 1
- name: create symbolic link to user config
shell: |
dirname /home/{{user}}/.{{item}} | xargs mkdir -p
ln -sf /home/{{user}}/.sysconf/dotfiles/{{item}} /home/{{user}}/.{{item}}
become: true
become_user: "{{user}}"
with_items:
- bashrc
- zshrc
- gitconfig
- gradle/gradle.properties
- ssh/config
- pam_environment
- gitconfig