-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't create an OS user if they have no ssh key.
- Loading branch information
Showing
1 changed file
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
# last_name: User | ||
# email: "[email protected]" | ||
# login_shell: "/bin/bash" (optional) | ||
# | ||
# | ||
# Alternatively if you are creating a project / group: | ||
# ansible-playbook -i <path to inventory> user_management.yml -e "@groupdata.yml" | ||
# example contents of the file groupdata.yml: | ||
|
@@ -117,7 +117,9 @@ | |
suffix: ".userdata" | ||
state: file | ||
register: usermgmt_tempfile | ||
when: username is defined | ||
when: | ||
- username is defined | ||
- ssh_public_key is defined | ||
- name: Populate the tempfile | ||
vars: | ||
user_list: | ||
|
@@ -133,13 +135,14 @@ | |
- usermgmt_tempfile.path is defined | ||
- name: Create the user on the bastion host | ||
ansible.builtin.command: | ||
argv: | ||
argv: | ||
- sudo | ||
- /root/bin/ikimuseradd.sh | ||
- "{{ usermgmt_tempfile.path }}" | ||
creates: "/home/{{ username }}" | ||
when: | ||
- username is defined | ||
- ssh_public_key is defined | ||
- usermgmt_tempfile.path is defined | ||
- name: Delete the temp file | ||
ansible.builtin.file: | ||
|
@@ -157,15 +160,17 @@ | |
- /opt/user_scripts/create_user_home.sh | ||
- "{{ username }}" | ||
creates: "/dpool/share/homes/{{ username }}" | ||
when: username is defined | ||
when: | ||
- username is defined | ||
- ssh_public_key is defined | ||
- name: Create the project directory | ||
ansible.builtin.command: | ||
argv: | ||
- sudo | ||
- /opt/user_scripts/create_new_project.sh | ||
- "{{ groupname }}" | ||
creates: "/dpool/share/projects/{{ groupname }}" | ||
when: | ||
when: | ||
- groupname is defined | ||
- is_project | ||
- name: Create the group directory | ||
|
@@ -175,8 +180,8 @@ | |
- /opt/user_scripts/create_new_group.sh | ||
- "{{ groupname }}" | ||
creates: "/dpool/share/groups/{{ groupname }}" | ||
when: | ||
- groupname is defined | ||
when: | ||
- groupname is defined | ||
- not is_project | ||
|
||
- hosts: slurm_user_facing | ||
|
@@ -197,7 +202,9 @@ | |
failed_when: | ||
- sacctmgr_result['rc'] != 0 | ||
- not (sacctmgr_result['stdout'] | regex_search('Nothing new added')) | ||
when: username is defined | ||
when: | ||
- username is defined | ||
- ssh_public_key is defined | ||
- name: Modify the Slurm Admin level of the user | ||
become: true | ||
ansible.builtin.command: | ||
|