From 5a3635de89a4a2eef0687e465f7c9979019b5209 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 1 Jan 2022 21:53:30 +0100 Subject: [PATCH] enable optional autologon --- README.md | 1 + defaults/main.yml | 5 +++++ tasks/autologon.yml | 11 +++++++++++ tasks/main.yml | 3 +++ tasks/obs_user.yml | 2 +- 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tasks/autologon.yml diff --git a/README.md b/README.md index 95243c1..cbed037 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,4 @@ Ansible role to deploy a obs setup on windows -------------- + Create User OBS + install OBS, VLC and MPV ++ optionally configure autologon *(see ``win_obs_init__autologon_*`` variables)* diff --git a/defaults/main.yml b/defaults/main.yml index 4fd04d7..1fbee63 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,10 @@ --- win_obs_init__pass_prefix: 'ansible/windows' +win_obs_init__user: 'obs' +win_obs_init__autologon: false +win_obs_init__autologon_state: present +win_obs_init__autologon_user: "{{ win_obs_init__user }}" +win_obs_init__autologon_password: 'pleaseDefine' win_obs_init__packages: - mpvio - vlc diff --git a/tasks/autologon.yml b/tasks/autologon.yml new file mode 100644 index 0000000..9123f0b --- /dev/null +++ b/tasks/autologon.yml @@ -0,0 +1,11 @@ +--- +- name: fail if win_obs_init__autologon_password unset + ansible.builtin.fail: + msg: "Please define a password for 'win_obs_init__autologon_password'!" + when: win_obs_init__autologon_password == 'pleaseDefine' + +- name: "Set autologon for {{ win_obs_init__autologon_user }}" + community.windows.win_auto_logon: + username: "{{ win_obs_init__autologon_user }}" + password: "{{ win_obs_init__autologon_password }}" + state: "{{ win_obs_init__autologon_state }}" diff --git a/tasks/main.yml b/tasks/main.yml index b641662..eb96d96 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,3 +5,6 @@ - name: install some obs specific packages ansible.builtin.include_tasks: packages.yml +- name: optionally autologon to obs user + ansible.builtin.include_tasks: autologon.yml + when: win_obs_init__autologon | bool diff --git a/tasks/obs_user.yml b/tasks/obs_user.yml index bb8c133..8596644 100644 --- a/tasks/obs_user.yml +++ b/tasks/obs_user.yml @@ -11,4 +11,4 @@ password_never_expires: true user_cannot_change_password: true groups: - - 'Benutzer' + - 'S-1-5-32-545' # Users