change task sshd_config to no root password

This commit is contained in:
Ruben Blanco 2023-10-18 10:58:22 +02:00
parent 708f4b1938
commit 2cb4b23cd5
2 changed files with 20 additions and 17 deletions

View File

@ -22,22 +22,26 @@
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# config sshd_config file , no root password # config sshd_config file , no root password
- name: change sshd_config to no root password - name: change sshd_config to no root password
copy: lineinfile:
src: "{{ source_path_ssh }}" path: "{{ path_sshd_config_file }}"
dest: "{{ dest_path_ssh }}" regexp: "PermitRootLogin yes"
remote_src: yes line: "#PermitRootLogin prohibit-password"
owner: root state: present
group: root #- name: change sshd_config to no root password
mode: '0644' # copy:
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # src: "{{ source_path_ssh }}"
# dest: "{{ dest_path_ssh }}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # remote_src: yes
# owner: root
# group: root
# mode: '0644'
# delete file sshd_config.orig # delete file sshd_config.orig
- name: delete /etc/ssh/sshd_config.orig file #- name: delete /etc/ssh/sshd_config.orig file
file: # file:
path: "{{ source_path_ssh }}" # path: "{{ source_path_ssh }}"
state: absent # state: absent
notify: Restart ssh service # notify: Restart ssh service
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@ -1,4 +1,3 @@
--- ---
source_path_ssh: /etc/ssh/sshd_config.orig path_sshd_config_file: /etc/ssh/sshd_config
dest_path_ssh: /etc/ssh/sshd_config
path_bashrc_root: /root/.bashrc path_bashrc_root: /root/.bashrc