-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
61 lines (48 loc) · 1.5 KB
/
site.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
---
- hosts:
- all
gather_facts: true
remote_user: ubuntu
sudo: true
sudo_user: root
vars:
- include: vars/main.yml
- root_passwd: entrar
pre_tasks:
- name: Comprobar si root tiene contraseña
shell: passwd -S ubuntu | cut -d " " -f 2
register: haspass
changed_when: not haspass.stdout == "P"
- name: Configurar "entrar" como contraseña de root
shell: 'echo root:{{ root_passwd }} | sudo chpasswd'
when: haspass|changed
- name: Permitir acceso por SSH mediante contraseña (ChallengeResponseAuthentication)
lineinfile: dest=/etc/ssh/sshd_config
regexp='^ChallengeResponseAuthentication'
line='ChallengeResponseAuthentication yes'
notify: restart ssh
- name: Permitir acceso por SSH mediante contraseña (PasswordAuthentication)
lineinfile: dest=/etc/ssh/sshd_config
regexp='^PasswordAuthentication'
line='PasswordAuthentication yes'
notify: restart ssh
- name: Permitir acceso por SSH mediante contraseña (PermitRootLogin)
lineinfile: dest=/etc/ssh/sshd_config
regexp='^PermitRootLogin'
line='PermitRootLogin yes'
notify: restart ssh
- name: Actualizar la lista de paquetes
apt: update_cache=yes
tags: update_cache
roles:
#- base
#- { role: base, tags: ["base"] }
- hostname
#- customize
tasks:
- name: Comprobar conectividad
ping:
tags:
- test
handlers:
- include: handlers/main.yml