-
Notifications
You must be signed in to change notification settings - Fork 2
/
dpt-cast-u1804.yml
88 lines (72 loc) · 2.46 KB
/
dpt-cast-u1804.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
---
- hosts: dpt-cast
user: root
handlers:
- name: restart sshd
service:
name: sshd
state: restarted
- name: configure br0
blockinfile:
dest: /etc/network/interfaces
block: |
# Puente br0 para lxd y kvm
auto {{ ansible_default_ipv4.interface }}
iface {{ ansible_default_ipv4.interface }} inet manual
auto br0
iface br0 inet dhcp
bridge_ports {{ ansible_default_ipv4.interface }}
- name: configure lxd0
command: systemctl restart networking
- name: configure lxd1
command: lxc storage create pool dir
- name: configure lxd2
command: lxc profile device add default root disk path=/ pool=pool
- name: configure lxd3
command: lxc network attach-profile br0 default
- name: dconf update
command: dconf update
tasks:
# Tareas por defecto
- include: default.yml
# Cambio de hostname
- include: /home/vcarceler/playbooks/cambia-hostname.yml base_hostname=dptcast
# Cambio en la configuración de sshd para bloquear la autenticación con password
- name: Bloquea la autenticación con password en /etc/ssh/sshd_config
replace:
dest: /etc/ssh/sshd_config
regexp: '^#PasswordAuthentication yes'
replace: 'PasswordAuthentication no'
notify:
- restart sshd
# Tareas generales de informática (DPT y Aulas)
#
# Borrado de usuarios por defecto (mati y tarda)
- include: del-default-users.yml
# Usuario invitado
- include: convidat.yml
# Gnome3 dconf
- include: gnome3-dconf.yml
# Instalación general de paquetes para Informàtica (DPT y Aulas)
- include: informatica-paquetes-u1804.yml
# Configura LXD
- name: Instala bridge-utils y LXD
action: apt pkg={{ item }} state=present
with_items:
- bridge-utils
- lxd
# Comprueba que no esté configurado LXD para no destrozar /etc/network/interfaces
# en la segunda ejecución, al ser la interfaz principal br0
- name: Comprueba si es necesario configurar el puente br0 en /etc/network/interfaces
lineinfile:
dest: /etc/network/interfaces
line: '# LXD configurado'
notify:
- configure br0
- configure lxd0
- configure lxd1
- configure lxd2
- configure lxd3
# Usuarios
- include: users/castellano/castellano.yml
#- include: users/informatica-u1804/manteniment.yml