trixie/roles/lmn_security/tasks/main.yml

30 lines
686 B
YAML
Raw Normal View History

2023-09-06 10:07:16 +02:00
---
- name: Deploy SSH keys
ansible.posix.authorized_key:
user: ansible
key: "{{ item }}"
loop: "{{ keys2deploy }}"
2023-09-15 21:20:51 +02:00
- name: Allow sudo without password for ansible
2023-09-06 10:07:16 +02:00
ansible.builtin.lineinfile:
path: /etc/sudoers.d/95-lmn-ansible
line: 'ansible ALL=(root) NOPASSWD: ALL'
create: True
owner: root
group: root
mode: '0700'
- name: Disable ansible user login
ansible.builtin.user:
name: ansible
password_lock: True
2023-09-15 21:20:51 +02:00
- name: Limit SSH access to user ansible
ansible.builtin.blockinfile:
dest: /etc/ssh/sshd_config.d/local.conf
create: true
block: |
PasswordAuthentication no
AllowUsers ansible
notify: Reload sshd