15dea747 by awx

Update main.yaml

1 parent c3464eb1
Showing 1 changed file with 7 additions and 23 deletions
---
- name: Desactivar acceso SSH como root
- name: Obtener información del sistema operativo
hosts: all
become: yes
tasks:
- name: Asegurar que 'PermitRootLogin no' esté en sshd_config
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?PermitRootLogin\s+.*'
line: 'PermitRootLogin no'
state: present
backrefs: yes
gather_facts: yes
become: no
- name: Asegurar que 'UsePAM yes' esté en sshd_config
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?UsePAM\s+.*'
line: 'UsePAM yes'
state: present
backrefs: yes
- name: Reiniciar el servicio sshd
service:
name: sshd
state: restarted
\ No newline at end of file
tasks:
- name: Mostrar versión del sistema operativo
debug:
msg: "El host {{ inventory_hostname }} tiene el sistema {{ ansible_distribution }} {{ ansible_distribution_version }} ({{ ansible_distribution_release }})"
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!