Skip to content
Open
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
35 changes: 34 additions & 1 deletion inventory-generation/identity-management/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
fail:
msg: "user_options.user_roles.options is not defined at runtime.json file or contain incorrect values"
when: >
user_options is undefined or
user_options is undefined or
user_options.user_roles is undefined or
user_options.user_roles.options is undefined or
user_options.user_roles.options[0].value is undefined
Expand Down Expand Up @@ -114,6 +114,39 @@
user_groups: "{{ (user_groups | default([])) + ldap_groups }}"


#####################################################################################################################
# Create generic user accounts
#

- name: Create generic accounts
set_fact:
generic_accounts: >-
{{ generic_accounts|d([]) +
[{
'first_name': 'lab' + item|string,
'last_name': 'lab' + item|string,
'email': 'lab' + item|string + '@localhost.com',
'user_name': 'lab' + item|string,
'password': 'lab' + item|string,
'generate_password': False,
'notify_user': False
}]
}}
user_names: "{{ user_names|d([]) + [ generic_accounts_base_name|d('lab')|string + item|string ] }}"
loop: "{{ range(1, number_of_generic_accounts+1)|list }}"

- set_fact:
generic_accounts_group: "{{ [{'name': generic_accounts_group_name|d('student')|string, 'members': user_names}] }}"

- debug:
var: group_members

- name: Add generic accounts to the user list
set_fact:
users: "{{ (users | default([])) + generic_accounts }}"
user_groups: "{{ (user_groups | default([])) + generic_accounts_group }}"


#####################################################################################################################
# Generate the CC list for emails
#
Expand Down