Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions roles/users_add/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
name: "{{ item.username }}"
state: present
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)

- name: Create user accounts and force password change on first login
ansible.builtin.user:
Expand All @@ -26,6 +28,8 @@
state: present
comment: "{{ item.username }} key"
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)

- name: Add all users who should be admin to sudo
ansible.builtin.lineinfile:
Expand All @@ -36,6 +40,8 @@
create: true
validate: '/usr/sbin/visudo -cf %s'
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)
when: item.admin

- name: Allow non-admin users to run system updates/upgrades
Expand Down Expand Up @@ -64,6 +70,8 @@
mode: '0440'
validate: '/usr/sbin/visudo -cf %s'
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)
when:
- not item.admin
- item.non_admin_allowed_commands is defined
Expand Down Expand Up @@ -92,6 +100,8 @@
owner: root
group: root
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)
when:
- not item.admin
- item.non_admin_allowed_commands is defined
Expand Down Expand Up @@ -352,6 +362,8 @@
groups: no2fa
append: true
loop: "{{ users_add_userlist | default([]) }}"
loop_control:
label: "{{ item.username }}" # avoid printing the full record (contains initialpassword)
when:
- enable_2fa | default(false)
- item.enable_2fa is defined
Expand Down
8 changes: 8 additions & 0 deletions setup-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@
label: "{{ item.path }}"
when: apt_mirror_sources.matched | int > 0

- name: Refresh apt cache with the corrected sources
ansible.builtin.apt:
update_cache: true
register: apt_cache_refresh
retries: 3
delay: 5
until: apt_cache_refresh is succeeded

tasks:
# ===================================================================
# USER MANAGEMENT SECTION
Expand Down
Loading