ansible lint fixes

This commit is contained in:
Fabio Sinibaldi 2026-07-24 15:01:05 +02:00
parent 889a74ec3a
commit b9fc6a9e8b
1 changed files with 22 additions and 22 deletions

View File

@ -1,35 +1,36 @@
- hosts: all ---
become: yes - name: Bootstrap node
#debugger: on_failed hosts: all
become: true
tasks: tasks:
- name: Add the ansible group - name: Add the ansible group
group: ansible.builtin.group:
name: ansible name: ansible
gid: 1100 gid: "1100"
state: present state: present
- name: Add the ansible user as a system user - name: Add the ansible user as a system user
user: ansible.builtin.user:
name: ansible name: ansible
uid: 1100 uid: "1100"
group: ansible group: ansible
# Directly generate hash # Directly generate hash
# https://www.lisenet.com/2019/ansible-generate-crypted-passwords-for-the-user-module/ # https://www.lisenet.com/2019/ansible-generate-crypted-passwords-for-the-user-module/
password: "{{ ansible_crypted_password | password_hash('sha512') }}" password: "{{ ansible_crypted_password | password_hash('sha512') }}"
shell: /bin/bash shell: /bin/bash
# Uncomment to prevent password reset # Uncomment to prevent password reset
update_password: on_create update_password: on_create
system: yes system: true
home: /home/ansible home: /home/ansible
state: present state: present
- name: Set ansible user as sudoer - name: Set ansible user as sudoer
copy: ansible.builtin.copy:
content: "ansible ALL = (ALL) NOPASSWD:ALL" content: "ansible ALL = (ALL) NOPASSWD:ALL"
dest: /etc/sudoers.d/ansible dest: /etc/sudoers.d/ansible
owner: root owner: root
group: root group: root
mode: 0440 mode: "0440"
- name: Init cache directory - name: Init cache directory
@ -49,22 +50,21 @@
mode: u=rwx,g=rw,o=r mode: u=rwx,g=rw,o=r
# Inserts public keys of allowed externals users to log in as ansible # Inserts public keys of allowed externals users to log in as ansible
# e.g. fabio # e.g. fabio
- name: Create the .ssh directory - name: Create the .ssh directory
file: ansible.builtin.file:
path: /home/ansible/.ssh path: /home/ansible/.ssh
owner: ansible owner: ansible
group: ansible group: ansible
mode: 0700 mode: "0700"
state: directory state: directory
- name: Add the mandatory ssh keys to the ansible user - name: Add the mandatory ssh keys to the ansible user
template: ansible.builtin.template:
src: templates/ansible_auth_keys.j2 src: templates/ansible_auth_keys.j2
dest: /home/ansible/.ssh/authorized_keys dest: /home/ansible/.ssh/authorized_keys
owner: ansible owner: ansible
group: ansible group: ansible
mode: 0600 mode: "0600"