-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
151 lines (130 loc) · 3.05 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
- hosts: all
gather_facts: False
pre_tasks:
- name: install python 2 for ansible
become: true
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
changed_when: False
- setup: # aka gather_facts
tasks:
- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: Install list of packages
become: true
apt: name={{item}} state=installed
with_items:
- tor
- git
- x11vnc
- xserver-xorg-core
- xserver-xorg-input-all
- xserver-xorg-video-fbdev
- xserver-xorg-legacy
- build-essential
- automake
- xinit
- libx11-dev
- libxft-dev
- libxinerama-dev
- libfreetype6-dev
- x11-xserver-utils
- plymouth
- locales
- gpredict
- firefox-esr
- user:
name: xorg
shell: /bin/bash
become: true
- synchronize:
src: dwm/
dest: /home/pi/dwm/
- copy:
src: xorg/xorg.service
dest: /etc/systemd/system/xorg.service
owner: root
group: root
mode: 0655
become: yes
- copy:
src: xorg/.xinitrc
dest: /home/xorg/.xinitrc
owner: xorg
group: xorg
mode: 0500
become: yes
- copy:
src: xorg/autostart.sh
dest: /home/xorg/autostart.sh
owner: xorg
group: xorg
mode: 0500
become: yes
- make:
chdir: /home/pi/dwm/
target: install
become: yes
- lineinfile:
path: /etc/X11/Xwrapper.config
regexp: '^allowed_users='
line: 'allowed_users=anybody'
become: yes
- lineinfile:
path: /etc/X11/Xwrapper.config
line: 'needs_root_rights=yes'
become: yes
- locale_gen:
name: en_US.UTF-8
state: present
become: yes
- lineinfile:
path: /etc/default/locale
state: present
line: 'LANG=en_US.UTF-8'
become: yes
- lineinfile:
path: /etc/default/locale
state: present
line: 'LC_ALL=en_US.UTF-8'
become: yes
- lineinfile:
path: /etc/ssh/sshd_config
state: present
line: 'PasswordAuthentication no'
become: yes
- name: enable service xorg and ensure it is not masked
systemd:
name: ssh
enabled: yes
masked: no
state: restarted
become: yes
- name: enable service xorg and ensure it is not masked
systemd:
name: xorg
enabled: yes
masked: no
state: restarted
become: yes
- copy:
src: tor/torrc
dest: /etc/tor/torrc
owner: root
group: root
mode: 644
become: yes
- name: enable service xorg and ensure it is not masked
systemd:
name: tor
enabled: yes
masked: no
state: restarted
become: yes
- name: Run a command using a templated variable (always use quote filter to avoid injection)
become: yes
raw: cat /var/lib/tor/ssh/hostname
- debug: msg="{{ details.stdout_lines | quote }}"