changed variable in conditional case for task to 'ansible_user' and uncommented user module task groups list item

This commit is contained in:
2026-05-29 08:13:40 -04:00
parent 00486fbc8d
commit 659feb3322

View File

@@ -2,7 +2,7 @@
---
# tasks file for roles/init-vps
- name: Checking whether administrative or root login used
when: ansible_facts["user_id"] not in (admins | map(attribute="username") | list) or ansible_facts["user_id"] != "root"
when: ansible_user not in (admins | map(attribute="username") | list) and ansible_user != "root"
ansible.builtin.fail:
msg: Must use administrative or root user for subsequent tasks
- name: Starting user and group creation for SSH access
@@ -23,7 +23,7 @@
comment: administrator
group: "{{ item.username }}"
groups:
- "{{ remote_group.name }}"
- "{{ remote_group.name | default('remote') }}"
- sudo # @NOTE used by Debian
append: true
generate_ssh_key: true