-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.yml
152 lines (137 loc) · 3.53 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
# Copyright 2022 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
---
- name: Update package lists
apt:
update_cache: yes
force_apt_get: yes
become: yes
- name: Install basic dependencies
apt:
name: "{{ packages }}"
state: present
force_apt_get: yes
become: yes
vars:
packages:
- bash-completion
- gdb
- locales
- git
- subversion
- name: Setting locale
locale_gen:
name: en_US.UTF-8
state: present
- name: Installing gosu
get_url:
url: https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64
dest: /usr/local/bin/gosu
mode: 0755
become: yes
- name: Check if gosu was installed correctly
command: gosu nobody true
- name: Install UI libs
apt:
name: "{{ packages }}"
state: present
become: yes
vars:
packages:
- xz-utils
- file
- dbus-x11
- pulseaudio
- dmz-cursor-theme
- fonts-dejavu
- fonts-liberation
- hicolor-icon-theme
- libcanberra-gtk3-0
- libcanberra-gtk-module
- libcanberra-gtk3-module
- libasound2
- libgtk2.0-0
- libdbus-glib-1-2
- libxt6
- libexif12
- libgl1-mesa-glx
- libgl1-mesa-dri
- name: Update locale
command: update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX
- name: Install basic tools
apt:
name: "{{ packages }}"
state: present
become: yes
vars:
packages:
- terminator
- vim
- mc
- name: Create UI user
user:
name: "{{ new_docker_user }}"
password: "{{ new_docker_user_password }}"
groups:
- sudo
- systemd-journal
- video
state: present
shell: /bin/bash
system: no
createhome: yes
become: yes
- name: Allow user to have passwordless sudo
lineinfile:
dest: /etc/sudoers
state: present
regexp: "^%{{ new_docker_user }}"
line: "%{{ new_docker_user }} ALL=(ALL) NOPASSWD: ALL"
validate: visudo -cf %s
become: yes
- name: Fix for QT and X server errors
lineinfile:
path: "{{ new_docker_user_home }}/.bashrc"
state: present
regexp: '^export\sQT_X11_NO_MITSHM'
line: 'export QT_X11_NO_MITSHM=1'
insertafter: EOF
- name: Insert Bash and Git completion scripts
blockinfile:
block: "{{ lookup('file', '../files/git_completion.sh') }}"
dest: "{{ new_docker_user_home }}/.bashrc"
backup: no
state: present
insertafter: EOF
- name: Create Terminator configuration directory
file:
path: "{{ new_docker_user_home }}/.config/terminator"
state: directory
owner: "{{ new_docker_user }}"
group: "{{ new_docker_user }}"
mode: 0775
recurse: yes
- name: Copy Terminator's configuration
copy:
src: ../files/terminator_config
dest: "{{ new_docker_user_home }}/.config/terminator/config"
owner: "{{ new_docker_user }}"
group: "{{ new_docker_user }}"
mode: 0644
- name: Copy entrypoint file
template:
src: "../templates/entrypoint.sh.j2"
dest: "/usr/local/bin/entrypoint.sh"
mode: 0755
become: yes