feat(host): добавить ключи root_home и раннера, отключить вход по паролю
This commit is contained in:
1 parent
5f91f7bc95
commit
0d19f80039
5 files changed
+49
-2
No files matched your search
@@ -6,6 +6,43 @@
|
||||
- name: Собрать факты
|
||||
ansible.builtin.setup:
|
||||
|
||||
- name: Создать каталог .ssh
|
||||
ansible.builtin.file:
|
||||
path: /root/.ssh
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Добавить авторизованные SSH-ключи
|
||||
ansible.builtin.lineinfile:
|
||||
path: /root/.ssh/authorized_keys
|
||||
line: "{{ item }}"
|
||||
state: present
|
||||
create: true
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
loop: "{{ host_authorized_keys }}"
|
||||
|
||||
- name: Отключить вход по паролю в drop-in sshd_config.d
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/ssh/sshd_config.d/99-disable-passwords.conf
|
||||
content: |
|
||||
PasswordAuthentication no
|
||||
KbdInteractiveAuthentication no
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Перезапустить SSH
|
||||
|
||||
- name: Запретить PasswordAuthentication в основном sshd_config
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^(#\s*)?PasswordAuthentication\s+.*'
|
||||
line: 'PasswordAuthentication no'
|
||||
notify: Перезапустить SSH
|
||||
|
||||
- name: Поставить Docker
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
|
||||
Reference in new issue
Block a user