-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprep.yml
166 lines (142 loc) · 4.11 KB
/
prep.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
---
- name: Prepare nodes
hosts: ansible
connection: local
become: true
handlers:
- name: Restart SSH daemon
service:
name: sshd
state: restarted
tasks:
- name: Fix keyboard layout
command: "/bin/localectl set-keymap de-nodeadkeys"
changed_when: false
- name: Install core utilities
yum:
name: "{{ core_packages }}"
vars:
core_packages:
- dos2unix
- vim
- nano
- bind-utils
- epel-release
- python3-pip
- firewalld
- name: Install Ansible
yum:
name: ansible
- name: Enable firewall as we don't like to live dangerously
service:
name: firewalld
state: started
enabled: true
- name: Enable services
firewalld:
service: "{{ item }}"
permanent: true
immediate: true
state: enabled
loop:
- ssh
- http
- name: Disable SELinux as this is a lab environment
selinux:
policy: targeted
state: permissive
- name: Add editor YAML support
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: '0644'
loop:
- src: /opt/prep/files/yaml.nanorc
dest: /usr/share/nano/yaml.nanorc
owner: root
group: root
- src: /opt/prep/files/vimrc.local
dest: /root/.vimrc
owner: root
group: root
- name: Install required Python packages
pip:
executable: pip3
state: latest
name:
- pip
- name: Install required Python packages
pip:
executable: pip3
name:
- cryptography
- molecule
- molecule-docker
- ansible-lint
- yamllint
- name: Install VS Code-Server
yum:
name: https://github.com/coder/code-server/releases/download/v4.2.0/code-server-4.2.0-amd64.rpm
disable_gpg_check: true
tags: code_server
- name: check 4 code-server User config dir
file:
path: /root/.local/share/code-server/User
state: directory
- name: configure a weng compfy
copy:
content: |
{
"terminal.integrated.copyOnSelection": true,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.defaultProfile.linux": "bash",
"workbench.iconTheme": "vscode-icons"
}
dest: /root/.local/share/code-server/User/settings.json
mode: '0644'
- name: Start and enable VS Code-Server
service:
name: code-server@root
state: started
enabled: true
tags: code_server
- name: "They see me waitin' they hatin'"
pause:
seconds: 5
- name: Set bind address for VS Code-Server
lineinfile:
path: /root/.config/code-server/config.yaml
regexp: '^bind-addr:'
line: 'bind-addr: 0.0.0.0:8080'
tags: code_server
- name: Disable telemetry for VS Code-Server (1/2)
lineinfile:
path: /usr/lib/systemd/user/code-server.service
regexp: '^ExecStart='
line: 'ExecStart=/usr/bin/code-server --disable-telemetry'
tags: code_server
- name: Disable telemetry for VS Code-Server (2/2)
lineinfile:
path: /usr/lib/systemd/system/[email protected]
regexp: '^ExecStart='
line: 'ExecStart=/usr/bin/code-server --disable-telemetry'
tags: code_server
- name: Set password for VS Code-Server
lineinfile:
path: /root/.config/code-server/config.yaml
regexp: '^password:'
line: 'password: ansible4tw'
tags: code_server
- name: Restart VS Code-Server
service:
name: code-server@root
state: restarted
tags: code_server
- name: Create forward rule (runtime) for VS Code Server
firewalld:
rich_rule: rule family=ipv4 forward-port port=80 protocol=tcp to-port=8080
permanent: true
immediate: true
state: enabled