HOW TO CHANGE A LINE IN A FILE IN AND RESTART A SERVICE
---
- name: modify el /etc/ssh/sshd_config to change root login
hosts: LINUX_SERVERS
tasks:
- name: /etc/ssh/sshd_config, line PermitRootLogin
lineinfile:
path: /etc/ssh/sshd_config
regexp: 'PermitRootLogin'
line: 'PermitRootLogin no'
- name: restart sshd daemon
service: name=sshd state=restarted
- name: status sshd daemon
service: name=sshd state=restarted
Comments