without sshd_config and delete authorized_keys
This commit is contained in:
parent
b997fc5d01
commit
a4623e0bd5
|
@ -18,16 +18,20 @@
|
||||||
name: root
|
name: root
|
||||||
password: "{{ ssh_password | password_hash('sha512') }}"
|
password: "{{ ssh_password | password_hash('sha512') }}"
|
||||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
# delete root ssh pub key in Authorized_keys
|
||||||
|
- name: delete ssh pub key in /root/.ssh/authorized_keys
|
||||||
|
file:
|
||||||
|
path: "{{ root_authorized_keys }}"
|
||||||
|
state: absent
|
||||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
# 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
|
||||||
lineinfile:
|
# lineinfile:
|
||||||
path: "{{ path_sshd_config_file }}"
|
# path: "{{ path_sshd_config_file }}"
|
||||||
regexp: "PermitRootLogin yes"
|
# regexp: "PermitRootLogin yes"
|
||||||
line: "#PermitRootLogin prohibit-password"
|
# line: "#PermitRootLogin prohibit-password"
|
||||||
state: present
|
# state: present
|
||||||
notify: Restart ssh service
|
# notify: Restart ssh service
|
||||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
# service should start on boot.
|
# service should start on boot.
|
||||||
- name: service should start on boot
|
- name: service should start on boot
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
ssh_daemon: ssh
|
ssh_daemon: ssh
|
||||||
path_sshd_config_file: /etc/ssh/sshd_config
|
path_sshd_config_file: /etc/ssh/sshd_config
|
||||||
path_bashrc_root: /root/.bashrc
|
path_bashrc_root: /root/.bashrc
|
||||||
|
root_authorized_keys: /root/.ssh/authorized_keys
|
||||||
export_LS_OPTIONS: export LS_OPTIONS='--color=auto'
|
export_LS_OPTIONS: export LS_OPTIONS='--color=auto'
|
||||||
eval_dircolors: eval "$(dircolors)"
|
eval_dircolors: eval "$(dircolors)"
|
||||||
alias_ls: alias ls='ls $LS_OPTIONS'
|
alias_ls: alias ls='ls $LS_OPTIONS'
|
||||||
|
|
Loading…
Reference in New Issue