Improve ansible code so that ansibe-lint shows fewer errors

This commit is contained in:
Raphael Dannecker 2025-03-24 07:33:56 +01:00
parent e8ef744f59
commit f965f4466c
23 changed files with 228 additions and 189 deletions

View file

@ -1,5 +1,5 @@
- name: Reload sshd
systemd:
ansible.builtin.systemd:
name: sshd
state: reloaded
when: not run_in_installer|default(false)|bool

View file

@ -9,7 +9,7 @@
ansible.builtin.lineinfile:
path: /etc/sudoers.d/95-lmn-ansible
line: 'ansible ALL=(root) NOPASSWD: ALL'
create: True
create: true
owner: root
group: root
mode: '0700'
@ -17,12 +17,13 @@
- name: Disable ansible user login
ansible.builtin.user:
name: ansible
password_lock: True
password_lock: true
- name: Limit SSH access to user ansible
ansible.builtin.blockinfile:
dest: /etc/ssh/sshd_config.d/local.conf
create: true
mode: '0644'
block: |
PasswordAuthentication no
AllowUsers ansible