changed variable in conditional case for task to 'ansible_user' and uncommented user module task groups list item
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
---
|
---
|
||||||
# tasks file for roles/init-vps
|
# tasks file for roles/init-vps
|
||||||
- name: Checking whether administrative or root login used
|
- 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:
|
ansible.builtin.fail:
|
||||||
msg: Must use administrative or root user for subsequent tasks
|
msg: Must use administrative or root user for subsequent tasks
|
||||||
- name: Starting user and group creation for SSH access
|
- name: Starting user and group creation for SSH access
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
comment: administrator
|
comment: administrator
|
||||||
group: "{{ item.username }}"
|
group: "{{ item.username }}"
|
||||||
groups:
|
groups:
|
||||||
- "{{ remote_group.name }}"
|
- "{{ remote_group.name | default('remote') }}"
|
||||||
- sudo # @NOTE used by Debian
|
- sudo # @NOTE used by Debian
|
||||||
append: true
|
append: true
|
||||||
generate_ssh_key: true
|
generate_ssh_key: true
|
||||||
|
|||||||
Reference in New Issue
Block a user