-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
145 lines (120 loc) · 3.94 KB
/
playbook.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
---
- hosts: all
become: yes
become_user: root
become_method: sudo
vars:
- specchio_database_password: "ALSOCHANGEME"
- specchio_webapp_database_password: '{{ specchio_database_password }}'
- specchio_client_admin_password: '{{ specchio_database_password }}'
pre_tasks:
- import_tasks: ca_injection.yml
- name: Set hostname
hostname:
name: specchio
- name: Generate /etc/hosts file
copy:
src: hosts
dest: /etc/hosts
owner: root
group: root
mode: 0644
- name: Disable SELinux
selinux:
state: disabled
- name: Update yum packages
yum:
name: '*'
state: latest
update_cache: yes
- name: Install epel-release
package:
name: epel-release
state: latest
- name: Install yum-cron
package:
name: yum-cron
state: latest
- name: Enable automatic updates through yum-cron
service:
name: yum-cron
state: started
enabled: yes
- name: Add SPECCHIO group
group:
name: specchio
state: present
- name: Add SPECCHIO user
user:
name: specchio
comment: SPECCHIO Spectral Information System
home: /home/specchio
group: specchio
groups: wheel # Add specchio user to sudo group
ignore_errors: yes
- name: Install GNOME desktop environment packages
yum:
name: "@^gnome-desktop-environment"
state: latest
- name: Install GNOME display manager package
package:
name: gdm
state: latest
- name: Set default target to "graphical"
shell: systemctl set-default graphical.target
- name: Change size of nautilus icons
shell: dbus-launch gsettings set org.gnome.nautilus.icon-view default-zoom-level 'small'
# Needed to remove the redirection (see https://serverfault.com/questions/1121140/i-cannot-download-mysql-connectorj-with-ansible-anymore?newreg=dc7103cad2fc46a9ac05db7931a339c6)
- name: Install MySQL repository (for MySQL workbench)
yum:
name: "https://repo.mysql.com//mysql80-community-release-el7-2.noarch.rpm"
state: present
- name: Install MySQL workbench
package:
name: mysql-workbench
state: latest
- name: Install debugging and developments utils
package:
name: "{{ item }}"
state: latest
loop:
- vim
- curl
- git
# This is an ugly hack to autotrust the SPECCHIO desktop link.
# https://askubuntu.com/questions/1070057/trust-desktop-icons-without-clicking-them-manually-in-ubuntu-18-04-gnome-3
- name: Autotrust SPECCHIO desktop link on login
blockinfile:
path: "{{specchio_client_user_home_directory}}/.bash_profile"
block: |
if [ -z "$SSH_CLIENT" ] || [ -z "$SSH_TTY" ]; then
declare -a LINKS=(
"/home/specchio/Desktop/SPECCHIO Java Client.desktop"
"/home/specchio/Desktop/SPECCHIO Backup Tool.desktop"
"/home/specchio/Desktop/SPECCHIO Update Tool.desktop"
)
TRIGGER_RELOAD=0
for LINK in "${LINKS[@]}"; do
if [[ -f "${LINK}" && $(gio info "${LINK}" | grep "metadata::trusted") == "" ]]; then
echo "Trust ${LINK}"
gio set "${LINK}" "metadata::trusted" yes
TRIGGER_RELOAD=1
fi
done
if [[ $TRIGGER_RELOAD -eq 1 ]]; then
pkill nautilus
fi
fi
roles:
- role: specchio_update_tool
- role: specchio_backup_tool
- role: specchio_client
- role: specchio_webapp
post_tasks:
- name: Cleanup sensitive files
file:
name: "{{ item }}"
state: absent
loop:
- /tmp/specchio_ca.p12
- /tmp/specchio_ca.crt