improve powerplan options

This commit is contained in:
L3D 2022-02-16 23:00:33 +01:00
parent 7d4c19584c
commit 7c30f1aa63
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 20 additions and 5 deletions

View file

@ -1,4 +0,0 @@
Write-Host "Disabling Screensaver"
Set-ItemProperty "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -Type DWord
& powercfg -x -monitor-timeout-ac 0
& powercfg -x -monitor-timeout-dc 0

View file

@ -9,6 +9,6 @@
ansible.builtin.include_tasks: autologon.yml ansible.builtin.include_tasks: autologon.yml
when: win_obs_init__autologon | bool when: win_obs_init__autologon | bool
- name: change the power plan to high performance - name: "change the power plan to {{ win_obs_init_powerplan_mode }}"
ansible.builtin.include_tasks: powerplan.yml ansible.builtin.include_tasks: powerplan.yml
when: win_obs_init__powerplan_enabled | bool when: win_obs_init__powerplan_enabled | bool

View file

@ -2,3 +2,22 @@
- name: change the power plan to high performance - name: change the power plan to high performance
community.windows.win_power_plan: community.windows.win_power_plan:
name: "{{ win_obs_init_powerplan_mode }}" name: "{{ win_obs_init_powerplan_mode }}"
- name: "apply custom powerplan poweshell script as {{ win_obs_init__user }}"
ansible.windows.win_powershell:
script: |
Write-Host "Disabling Screensaver"
Set-ItemProperty "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -Type DWord
& powercfg -x -monitor-timeout-ac 0
& powercfg -x -monitor-timeout-dc 0
& powercfg -x standby-timeout-ac 0
& powercfg -x standby-timeout-dc 0
& powercfg -x hibernate-timeout-ac 0
& powercfg -x hibernate-timeout-dc 0
& powercfg -x disk-timeout-ac 0
& powercfg -x disk-timeout-dc 0
become: true
become_method: runas
become_user: "{{ win_obs_init__user }}"
vars:
ansible_become_pass: '{{ win_obs_init__password }}'