REFACTOR: files fixed according to ansible-lint

This commit is contained in:
2026-07-12 15:36:55 +00:00
parent 9a9bfa7e23
commit d1568586e9
8 changed files with 69 additions and 58 deletions
@@ -1,20 +1,20 @@
---
## Installing packages
- name: Install sudo on apt systems
when: (ansible_facts['distribution'] == "Debian") or
when: (ansible_facts['distribution'] == "Debian") or
(ansible_facts['distribution'] == "Ubuntu")
apt:
ansible.builtin.apt:
name:
- sudo
update-cache: yes
update-cache: true
- name: Update Alpine packages
# The same commands for Alpine
- name: Update and install packages on Alpine
when: (ansible_facts['distribution'] == "Alpine")
command: /sbin/apk update
- name: Install sudo package on Alpine
when: (ansible_facts['distribution'] == "Alpine")
command: /sbin/apk add sudo
community.general.apk:
name: sudo
update_cache: true
remote_user: ansible
## Creating and setting up the ansible user
@@ -26,16 +26,16 @@
## Add the user to sshusers (for ssh access) and sudo (gain root access)
- name: Create a new user with a password for Ansible
user:
ansible.builtin.user:
name: ansible
password: "{{ ansible_user_passwd_hash }}"
groups: sshusers,sudo
append: yes
append: true
## Since password authentication in SSH will be disabled, we need to add an authorized key
## Since password authentication in SSH will be disabled, we need to add an authorized key
- name: Set authorized key taken from file
ansible.posix.authorized_key:
user: ansible
state: present
key: "{{ ansible_ssh_key }}"
key: "{{ ansible_ssh_key }}"