Update main.yaml
Showing
1 changed file
with
7 additions
and
23 deletions
| 1 | --- | 1 | --- |
| 2 | - name: Desactivar acceso SSH como root | 2 | - name: Obtener información del sistema operativo |
| 3 | hosts: all | 3 | hosts: all |
| 4 | become: yes | 4 | gather_facts: yes |
| 5 | tasks: | 5 | become: no |
| 6 | |||
| 7 | - name: Asegurar que 'PermitRootLogin no' esté en sshd_config | ||
| 8 | lineinfile: | ||
| 9 | path: /etc/ssh/sshd_config | ||
| 10 | regexp: '^#?PermitRootLogin\s+.*' | ||
| 11 | line: 'PermitRootLogin no' | ||
| 12 | state: present | ||
| 13 | backrefs: yes | ||
| 14 | 6 | ||
| 15 | - name: Asegurar que 'UsePAM yes' esté en sshd_config | ||
| 16 | lineinfile: | ||
| 17 | path: /etc/ssh/sshd_config | ||
| 18 | regexp: '^#?UsePAM\s+.*' | ||
| 19 | line: 'UsePAM yes' | ||
| 20 | state: present | ||
| 21 | backrefs: yes | ||
| 22 | |||
| 23 | - name: Reiniciar el servicio sshd | ||
| 24 | service: | ||
| 25 | name: sshd | ||
| 26 | state: restarted | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 7 | tasks: | ||
| 8 | - name: Mostrar versión del sistema operativo | ||
| 9 | debug: | ||
| 10 | msg: "El host {{ inventory_hostname }} tiene el sistema {{ ansible_distribution }} {{ ansible_distribution_version }} ({{ ansible_distribution_release }})" | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment