chore(user): use FQCNs for module calls and other lint fixes

This commit is contained in:
Jan Christian Grünhage 2024-08-19 16:55:40 +02:00
parent 936065719b
commit ab0e56e09a
No known key found for this signature in database
GPG key ID: EEC1170CE56FA2ED
3 changed files with 9 additions and 9 deletions

View file

@ -1,3 +1,3 @@
---
users_sudo_namespace: "ansible-managed"
users: []
users_sudo_namespace: "ansible-managed" # noqa: var-naming[no-role-prefix]
users: [] # noqa: var-naming[no-role-prefix]

View file

@ -1,6 +1,6 @@
---
- name: "Ensure sudo is installed"
package:
ansible.builtin.package:
name: "sudo"
state: "present"
register: "task_result"
@ -15,7 +15,7 @@
tags: ['deploy', 'deploy-users']
- name: "Loop over users and include per-user tasks"
include_tasks: "user.yml"
ansible.builtin.include_tasks: "user.yml"
loop: "{{ users | dict2items(key_name='name', value_name='attrs') }}"
loop_control:
loop_var: "user"
@ -23,7 +23,7 @@
tags: ['deploy', 'deploy-users']
- name: "Template sudoers.d managed file"
template:
ansible.builtin.template:
src: "sudoers.j2"
dest: "/etc/sudoers.d/{{ users_sudo_namespace }}"
owner: "root"

View file

@ -1,6 +1,6 @@
---
- name: "Ensure user {{ user.name }} is {{ user.attrs.active | default(false) | ternary('present', 'absent') }}"
user:
- name: "Ensure user {{ user.name }} is {{ user.attrs.active | default(false) | ternary('present', 'absent') }}" # noqa: name[template]
ansible.builtin.user:
name: "{{ user.name }}"
shell: "{{ user.attrs.shell | default(omit) }}"
groups: >-
@ -18,8 +18,8 @@
remove: true
become: true
- name: "Ensure ssh keys for {{ user.name }} are up to date"
authorized_key:
- name: "Ensure ssh keys for {{ user.name }} are up to date" # noqa: name[template]
ansible.posix.authorized_key:
user: "{{ user.name }}"
key: "{{ user.attrs.ssh | join('\n') }}"
exclusive: true